Add contact search test #2866

This commit is contained in:
Martin Lensment 2015-08-19 17:13:52 +03:00
parent e8a4706e73
commit 5efdd47f62

View file

@ -22,4 +22,39 @@ feature 'Admin contact', type: :feature do
# indivitually running it's created by autotest
page.should have_content(/by [unknown|autotest]/)
end
it 'should search contacts by name' do
d1 = Fabricate(:contact, name: 'first name')
Fabricate(:contact, name: 'second name')
Fabricate(:contact, name: 'third name')
sign_in @user
visit admin_contacts_url
page.should have_content('first name')
page.should have_content('second name')
page.should have_content('third name')
fill_in 'q_name_matches', with: 'first name'
find('.btn.btn-primary').click
current_path.should == "/admin/contacts"
page.should have_content('first name')
page.should_not have_content('second name')
page.should_not have_content('third name')
fill_in 'q_name_matches', with: '%name'
find('.btn.btn-primary').click
page.should have_content('first name')
page.should have_content('second name')
page.should have_content('third name')
fill_in 'q_name_matches', with: 'sec___ name'
find('.btn.btn-primary').click
page.should_not have_content('first name')
page.should have_content('second name')
page.should_not have_content('third name')
end
end