diff options
| author | vlatka pavisic | 2016-12-02 15:10:55 +0100 | 
|---|---|---|
| committer | vlatka pavisic | 2016-12-02 15:11:48 +0100 | 
| commit | 47572dc97aa526dc702d7456bb7459786eb1eb0e (patch) | |
| tree | 5fd79dc1ca3085bd813db37819e45e753e470c66 /spec/features | |
| parent | 2a92002b6e4a6a54af85f8144e25944043eefb0f (diff) | |
| download | chouette-core-47572dc97aa526dc702d7456bb7459786eb1eb0e.tar.bz2 | |
Refs #2133 : Feature specs for referential companies, lines... and search
Diffstat (limited to 'spec/features')
| -rw-r--r-- | spec/features/companies_spec.rb | 30 | ||||
| -rw-r--r-- | spec/features/group_of_lines_spec.rb | 18 | ||||
| -rw-r--r-- | spec/features/lines_spec.rb | 33 | ||||
| -rw-r--r-- | spec/features/networks_spec.rb | 28 | ||||
| -rw-r--r-- | spec/features/referential_companies_spec.rb | 41 | ||||
| -rw-r--r-- | spec/features/referential_group_of_lines_spec.rb | 34 | ||||
| -rw-r--r-- | spec/features/referential_lines_spec.rb | 49 | ||||
| -rw-r--r-- | spec/features/referential_networks_spec.rb | 42 | ||||
| -rw-r--r-- | spec/features/referential_stop_areas_spec.rb | 43 | ||||
| -rw-r--r-- | spec/features/stop_areas_spec.rb | 27 | 
10 files changed, 318 insertions, 27 deletions
| diff --git a/spec/features/companies_spec.rb b/spec/features/companies_spec.rb index 08221f637..9c024adbf 100644 --- a/spec/features/companies_spec.rb +++ b/spec/features/companies_spec.rb @@ -8,19 +8,41 @@ describe "Companies", :type => :feature do    let!(:companies) { Array.new(2) { create :company, line_referential: line_referential } }    subject { companies.first } -  describe "list" do -    it "display companies" do -      visit line_referential_companies_path(line_referential) +  describe "index" do +    before(:each) { visit line_referential_companies_path(line_referential) } + +    it "displays companies" do        expect(page).to have_content(companies.first.short_name)        expect(page).to have_content(companies.last.short_name)      end +    context 'fitering' do +      it 'supports filtering by name' do +        fill_in 'q[name_or_objectid_cont]', with: companies.first.name +        click_button 'search-btn' +        expect(page).to have_content(companies.first.name) +        expect(page).not_to have_content(companies.last.name) +      end + +      it 'supports filtering by objectid' do +        fill_in 'q[name_or_objectid_cont]', with: companies.first.objectid +        click_button 'search-btn' +        expect(page).to have_content(companies.first.name) +        expect(page).not_to have_content(companies.last.name) +      end +    end +  end + +  describe "show" do +    it "displays line" do +      visit line_referential_company_path(line_referential, companies.first) +      expect(page).to have_content(companies.first.name) +    end    end    # describe "show" do    #   it "display company" do    #     visit line_referential_companies_path(line_referential) -  #     click_link "#{companies.first.name}"    #     expect(page).to have_content(companies.first.name)    #   end    # diff --git a/spec/features/group_of_lines_spec.rb b/spec/features/group_of_lines_spec.rb index 5b9522591..cbdb2fade 100644 --- a/spec/features/group_of_lines_spec.rb +++ b/spec/features/group_of_lines_spec.rb @@ -16,16 +16,26 @@ describe "Group of lines", :type => :feature do      subject.lines << line    end -  describe "list" do -    it "display group of lines" do -      visit line_referential_group_of_lines_path(line_referential) +  describe "index" do +    before(:each) { visit line_referential_group_of_lines_path(line_referential) } + +    it "displays groups of lines" do        expect(page).to have_content(group_of_lines.first.name)        expect(page).to have_content(group_of_lines.last.name)      end + +    context 'fitering' do +      it 'supports filtering by name' do +        fill_in 'q[name_cont]', with: group_of_lines.first.name +        click_button 'search-btn' +        expect(page).to have_content(group_of_lines.first.name) +        expect(page).not_to have_content(group_of_lines.last.name) +      end +    end    end    describe "show" do -    it "display group of line" do +    it "displays group of line" do        visit line_referential_group_of_lines_path(line_referential)        click_link "#{subject.name}"        expect(page).to have_content(subject.name) diff --git a/spec/features/lines_spec.rb b/spec/features/lines_spec.rb index 7ff1048bf..bbb149e3c 100644 --- a/spec/features/lines_spec.rb +++ b/spec/features/lines_spec.rb @@ -11,19 +11,40 @@ describe "Lines", :type => :feature do    let!(:group_of_line) { create(:group_of_line) }    subject { lines.first } -  describe "list" do -    it "display lines" do -      visit line_referential_lines_path(line_referential) +  describe "index" do +    before(:each) { visit line_referential_lines_path(line_referential) } + +    it "displays lines" do        expect(page).to have_content(lines.first.name)        expect(page).to have_content(lines.last.name)      end +    context 'fitering' do +      it 'supports filtering by name' do +        fill_in 'q[name_or_number_or_objectid_cont]', with: lines.first.name +        click_button 'search-btn' +        expect(page).to have_content(lines.first.name) +        expect(page).not_to have_content(lines.last.name) +      end + +      it 'supports filtering by number' do +        fill_in 'q[name_or_number_or_objectid_cont]', with: lines.first.number +        click_button 'search-btn' +        expect(page).to have_content(lines.first.name) +        expect(page).not_to have_content(lines.last.name) +      end + +      it 'supports filtering by objectid' do +        fill_in 'q[name_or_number_or_objectid_cont]', with: lines.first.objectid +        click_button 'search-btn' +        expect(page).to have_content(lines.first.name) +        expect(page).not_to have_content(lines.last.name) +      end +    end    end    describe "show" do -    it "display line" do -      visit line_referential_lines_path(line_referential) -      # click_link "Voir" +    it "displays line" do        visit line_referential_line_path(line_referential, lines.first)        expect(page).to have_content(lines.first.name)      end diff --git a/spec/features/networks_spec.rb b/spec/features/networks_spec.rb index e5decfb00..ed02b3788 100644 --- a/spec/features/networks_spec.rb +++ b/spec/features/networks_spec.rb @@ -8,20 +8,34 @@ describe "Networks", :type => :feature do    let!(:networks) { Array.new(2) { create(:network, line_referential: line_referential) } }    subject { networks.first } -  describe "list" do -    it "display networks" do -      visit line_referential_networks_path(line_referential) +  describe "index" do +    before(:each) { visit line_referential_networks_path(line_referential) } + +    it "displays networks" do        expect(page).to have_content(networks.first.name)        expect(page).to have_content(networks.last.name)      end +    context 'fitering' do +      it 'supports filtering by name' do +        fill_in 'q[name_or_objectid_cont]', with: networks.first.name +        click_button 'search-btn' +        expect(page).to have_content(networks.first.name) +        expect(page).not_to have_content(networks.last.name) +      end + +      it 'supports filtering by objectid' do +        fill_in 'q[name_or_objectid_cont]', with: networks.first.objectid +        click_button 'search-btn' +        expect(page).to have_content(networks.first.name) +        expect(page).not_to have_content(networks.last.name) +      end +    end    end    describe "show" do -    it "display network" do -      # allow(subject).to receive(:stop_areas).and_return(Array.new(2) { create(:stop_area) }) -      visit line_referential_networks_path(line_referential) -      # click_link "#{networks.first.name}" +    it "displays network" do +      visit line_referential_network_path(line_referential, networks.first)        expect(page).to have_content(networks.first.name)      end diff --git a/spec/features/referential_companies_spec.rb b/spec/features/referential_companies_spec.rb new file mode 100644 index 000000000..ac3f5b9d5 --- /dev/null +++ b/spec/features/referential_companies_spec.rb @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +require 'spec_helper' + +describe 'ReferentialCompanies', type: :feature do +  login_user + +  let(:referential) { Referential.first } +  let(:companies) { Array.new(2) { create :company, line_referential: referential.line_referential } } + +  describe 'index' do +    before(:each) { visit referential_companies_path(referential) } + +    it 'displays referential companies' do +      expect(page).to have_content(companies.first.name) +      expect(page).to have_content(companies.last.name) +    end + +    context 'fitering' do +      it 'supports filtering by name' do +        fill_in 'q[name_or_objectid_cont]', with: companies.first.name +        click_button 'search-btn' +        expect(page).to have_content(companies.first.name) +        expect(page).not_to have_content(companies.last.name) +      end + +      it 'supports filtering by objectid' do +        fill_in 'q[name_or_objectid_cont]', with: referential.companies.first.objectid +        click_button 'search-btn' +        expect(page).to have_content(referential.companies.first.name) +        expect(page).not_to have_content(referential.companies.last.name) +      end +    end +  end + +  describe 'show' do +    it 'displays referential company' do +      visit referential_company_path(referential, companies.first) +      expect(page).to have_content(referential.companies.first.name) +    end +  end +end diff --git a/spec/features/referential_group_of_lines_spec.rb b/spec/features/referential_group_of_lines_spec.rb new file mode 100644 index 000000000..585519fba --- /dev/null +++ b/spec/features/referential_group_of_lines_spec.rb @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +require 'spec_helper' + +describe 'ReferentialLines', type: :feature do +  login_user + +  let(:referential) { Referential.first } +  let(:group_of_lines) { Array.new(2) { create(:group_of_line, line_referential: Referential.first.line_referential) } } + +  describe 'index' do +    before(:each) { visit referential_group_of_lines_path(referentialre) } + +    it 'displays referential groups of lines' do +      expect(page).to have_content(group_of_lines.first.name) +      expect(page).to have_content(group_of_lines.last.name) +    end + +    context 'fitering' do +      it 'supports filtering by name' do +        fill_in 'q[name_cont]', with: group_of_lines.first.name +        click_button 'search-btn' +        expect(page).to have_content(group_of_lines.first.name) +        expect(page).not_to have_content(group_of_lines.last.name) +      end +    end +  end + +  describe 'show' do +    it 'displays referential group of lines' do +      visit referential_group_of_line_path(referential, group_of_lines.first) +      expect(page).to have_content(group_of_lines.first.name) +    end +  end +end diff --git a/spec/features/referential_lines_spec.rb b/spec/features/referential_lines_spec.rb new file mode 100644 index 000000000..ea828e6cb --- /dev/null +++ b/spec/features/referential_lines_spec.rb @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +require 'spec_helper' + +describe 'ReferentialLines', type: :feature do +  login_user + +  before(:all) { create :referential_metadata, referential: Referential.first } + +  let(:referential) { Referential.first } + +  describe 'index' do +    before(:each) { visit referential_lines_path(referential) } + +    it 'displays referential lines' do +      expect(page).to have_content(referential.lines.first.name) +      expect(page).to have_content(referential.lines.last.name) +    end + +    context 'fitering' do +      it 'supports filtering by name' do +        fill_in 'q[name_or_number_or_objectid_cont]', with: referential.lines.first.name +        click_button 'search-btn' +        expect(page).to have_content(referential.lines.first.name) +        expect(page).not_to have_content(referential.lines.last.name) +      end + +      it 'supports filtering by number' do +        fill_in 'q[name_or_number_or_objectid_cont]', with: referential.lines.first.number +        click_button 'search-btn' +        expect(page).to have_content(referential.lines.first.name) +        expect(page).not_to have_content(referential.lines.last.name) +      end + +      it 'supports filtering by objectid' do +        fill_in 'q[name_or_number_or_objectid_cont]', with: referential.lines.first.objectid +        click_button 'search-btn' +        expect(page).to have_content(referential.lines.first.name) +        expect(page).not_to have_content(referential.lines.last.name) +      end +    end +  end + +  describe 'show' do +    it 'displays referential line' do +      visit referential_line_path(referential, referential.lines.first) +      expect(page).to have_content(referential.lines.first.name) +    end +  end +end diff --git a/spec/features/referential_networks_spec.rb b/spec/features/referential_networks_spec.rb new file mode 100644 index 000000000..f1f1d0ecc --- /dev/null +++ b/spec/features/referential_networks_spec.rb @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +require 'spec_helper' + +describe 'ReferentialNetworks', type: :feature do +  login_user + +  let(:referential) { Referential.first } +  let(:networks) { Array.new(2) { create :network, line_referential: referential.line_referential } } + + +  describe 'index' do +    before(:each) { visit referential_networks_path(referential) } + +    it 'displays referential networks' do +      expect(page).to have_content(networks.first.name) +      expect(page).to have_content(networks.last.name) +    end + +    context 'fitering' do +      it 'supports filtering by name' do +        fill_in 'q[name_or_objectid_cont]', with: networks.first.name +        click_button 'search-btn' +        expect(page).to have_content(networks.first.name) +        expect(page).not_to have_content(networks.last.name) +      end + +      it 'supports filtering by objectid' do +        fill_in 'q[name_or_objectid_cont]', with: networks.first.objectid +        click_button 'search-btn' +        expect(page).to have_content(networks.first.name) +        expect(page).not_to have_content(networks.last.name) +      end +    end +  end + +  describe 'show' do +    it 'displays referential network' do +      visit referential_network_path(referential, networks.first) +      expect(page).to have_content(networks.first.name) +    end +  end +end diff --git a/spec/features/referential_stop_areas_spec.rb b/spec/features/referential_stop_areas_spec.rb new file mode 100644 index 000000000..00ddfae07 --- /dev/null +++ b/spec/features/referential_stop_areas_spec.rb @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +require 'spec_helper' + +describe 'ReferentialStopAreas', type: :feature do +  login_user + +  let(:referential) { Referential.first } +  let(:stop_area_referential) { create :stop_area_referential } +  let(:stop_areas) { Array.new(2) { create :stop_area, stop_area_referential: stop_area_referential } } + + +  describe 'index' do +    before(:each) { visit referential_stop_areas_path(referential) } + +    it 'displays referential 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 'displays referential stop area' do +      visit referential_stop_area_path(referential, stop_areas.first) +      expect(page).to have_content(stop_areas.first.name) +    end +  end +end 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 | 
