-
Notifications
You must be signed in to change notification settings - Fork 0
/
books_test.rb
44 lines (39 loc) · 1.4 KB
/
books_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# encoding: utf-8
require 'minitest/autorun'
describe 'books.rb' do
def books(args)
`ruby books.rb #{args}`
end
it 'filters by author' do
books = self.books('-a "Karel Čapek"')
expected_books = <<BOOKS
Guillaume Apollinaire, Karel Čapek, Adolf Kroupa, Milan Kundera (1965): Alkoholy života
Karel Čapek (1924): Anglické listy
Karel Čapek (1925): Anglické listy
Karel Čapek (1947): Anglické listy
Karel Čapek (1970): Anglické listy
Karel Čapek, Norma Comrada (1997): Apocryphal tales
Karel Čapek (1932): Apokryfy.
Karel Čapek, Lawrence Hyde (1948): An atomic phantasy
Karel Čapek (1988): Aus der einen Tasche in die andere
Karel Čapek, Anna Auředníčková (1976): Das Absolutum, oder, Die Gottesfabrik
Karel Čapek (1961): Bajky a podpovídky.
BOOKS
books.lines.sort.must_equal expected_books.lines.sort
end
it 'filters by author and language' do
books = self.books('-a "Karel Čapek" -l eng')
expected_books = <<BOOKS
Karel Čapek, Norma Comrada (1997): Apocryphal tales
Karel Čapek, Lawrence Hyde (1948): An atomic phantasy
BOOKS
books.lines.sort.must_equal expected_books.lines.sort
end
it 'filters by author and language and publisher' do
books = self.books('-a "Karel Čapek" -l eng -p "Catbird Press"')
expected_books = <<BOOKS
Karel Čapek, Norma Comrada (1997): Apocryphal tales
BOOKS
books.lines.sort.must_equal expected_books.lines.sort
end
end