/
Search_concordance.rb
38 lines (33 loc) · 1.09 KB
/
Search_concordance.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
feature 'Search for a concordance' do
def submitForm
click_on "submit"
end
scenario 'Search a valid sequence of words' do
visit '/works/concordance'
fill_input '#query', 'the ancient oil'
fill_select 'language', 'en'
submitForm()
expect(page).to have_in_bold 'the ancient oil'
expect(page).to have_content 'Trans. François Truchaud'
expect(page).to have_content 'Trans. Aurélien Bénel'
end
scenario 'Search a sequence of words in the wrong order' do
visit '/works/concordance'
fill_input '#query', 'ancient the'
fill_select 'language', 'en'
submitForm()
wait_for_ajax
expect(page).not_to have_content 'Trans. Aurélien Bénel'
expect(page).not_to have_content 'Trans. François Truchaud'
end
scenario 'Search the beginning of a word' do
visit '/works/concordance'
fill_input '#query', 'anc'
fill_select 'language', 'en'
submitForm()
wait_for_ajax
expect(page).to have_in_bold('anc')
expect(page).to have_content 'Trans. François Truchaud'
expect(page).to have_content 'Trans. Aurélien Bénel'
end
end