From 47572dc97aa526dc702d7456bb7459786eb1eb0e Mon Sep 17 00:00:00 2001 From: vlatka pavisic Date: Fri, 2 Dec 2016 15:10:55 +0100 Subject: Refs #2133 : Feature specs for referential companies, lines... and search --- spec/features/stop_areas_spec.rb | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'spec/features/stop_areas_spec.rb') diff --git a/spec/features/stop_areas_spec.rb b/spec/features/stop_areas_spec.rb index 3dbb7b658..a1ec37a0a 100644 --- a/spec/features/stop_areas_spec.rb +++ b/spec/features/stop_areas_spec.rb @@ -8,18 +8,33 @@ describe "StopAreas", :type => :feature do let!(:stop_areas) { Array.new(2) { create :stop_area, stop_area_referential: stop_area_referential } } subject { stop_areas.first } - describe "list" do - it "display stop_areas" do - visit stop_area_referential_stop_areas_path(stop_area_referential) + describe "index" do + before(:each) { visit stop_area_referential_stop_areas_path(stop_area_referential) } + + it "displays stop_areas" do expect(page).to have_content(stop_areas.first.name) expect(page).to have_content(stop_areas.last.name) end + + context 'fitering' do + it 'supports filtering by name' do + fill_in 'q[name_or_objectid_cont]', with: stop_areas.first.name + click_button 'search-btn' + expect(page).to have_content(stop_areas.first.name) + expect(page).not_to have_content(stop_areas.last.name) + end + + it 'supports filtering by objectid' do + fill_in 'q[name_or_objectid_cont]', with: stop_areas.first.objectid + click_button 'search-btn' + expect(page).to have_content(stop_areas.first.name) + expect(page).not_to have_content(stop_areas.last.name) + end + end end describe "show" do - it "display stop_area" do - visit stop_area_referential_stop_areas_path(stop_area_referential) - # click_link "#{stop_areas.first.name}" + it "displays stop_area" do visit stop_area_referential_stop_area_path(stop_area_referential, stop_areas.first) expect(page).to have_content(stop_areas.first.name) end -- cgit v1.2.3