diff options
| author | vlatka pavisic | 2016-11-09 15:10:29 +0100 | 
|---|---|---|
| committer | vlatka pavisic | 2016-11-09 15:10:29 +0100 | 
| commit | 21c6807d2167ffdbcaed58844d1ebafb06c22d6e (patch) | |
| tree | d4f0bca5b97266f08a956de2b946a1bf79a3e964 /spec | |
| parent | 56c0f55d2d8d566b931664b85c76dbe3a58e31cc (diff) | |
| parent | 0dbc80d54b1362c9eb0fc87d8d93f3d60ade68e1 (diff) | |
| download | chouette-core-21c6807d2167ffdbcaed58844d1ebafb06c22d6e.tar.bz2 | |
Refs #1872 : Fix conflicts
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/features/access_points_spec.rb | 37 | ||||
| -rw-r--r-- | spec/features/routes_spec.rb | 33 | ||||
| -rw-r--r-- | spec/models/organisation_spec.rb | 2 | ||||
| -rw-r--r-- | spec/models/user_spec.rb | 2 | ||||
| -rw-r--r-- | spec/models/workbench_spec.rb | 23 | 
5 files changed, 43 insertions, 54 deletions
| diff --git a/spec/features/access_points_spec.rb b/spec/features/access_points_spec.rb index a78545ee4..327c5879a 100644 --- a/spec/features/access_points_spec.rb +++ b/spec/features/access_points_spec.rb @@ -40,24 +40,25 @@ describe "Access points", :type => :feature do    end -  describe "new" do -    it "creates an access point" do -      visit referential_stop_area_path(referential, stop_area) -      click_link I18n.t("access_points.actions.new") -      fill_in "access_point[name]", :with => "My Access Point Name" -      click_button(I18n.t('formtastic.create',model: I18n.t('activerecord.models.access_point.one'))) -      expect(page).to have_content("My Access Point Name") -    end -  end +  # Fixme #1780 +  # describe "new" do +  #   it "creates an access point" do +  #     visit referential_stop_area_path(referential, stop_area) +  #     click_link I18n.t("access_points.actions.new") +  #     fill_in "access_point[name]", :with => "My Access Point Name" +  #     click_button(I18n.t('formtastic.create',model: I18n.t('activerecord.models.access_point.one'))) +  #     expect(page).to have_content("My Access Point Name") +  #   end +  # end -  describe "edit" do -    it "edits an acess point" do -      visit referential_stop_area_access_point_path(referential, stop_area, subject) -      click_link I18n.t("access_points.actions.edit") -      fill_in "access_point[name]", :with => "My New Access Point Name" -      click_button(I18n.t('formtastic.update',model: I18n.t('activerecord.models.access_point.one'))) -      expect(page).to have_content("My New Access Point Name") -    end -  end +  # describe "edit" do +  #   it "edits an acess point" do +  #     visit referential_stop_area_access_point_path(referential, stop_area, subject) +  #     click_link I18n.t("access_points.actions.edit") +  #     fill_in "access_point[name]", :with => "My New Access Point Name" +  #     click_button(I18n.t('formtastic.update',model: I18n.t('activerecord.models.access_point.one'))) +  #     expect(page).to have_content("My New Access Point Name") +  #   end +  # end  end diff --git a/spec/features/routes_spec.rb b/spec/features/routes_spec.rb index bb4b8ae3b..70f3448ab 100644 --- a/spec/features/routes_spec.rb +++ b/spec/features/routes_spec.rb @@ -41,39 +41,6 @@ describe "Routes", :type => :feature do      end    end -  describe "from line's page, select a route and edit it" do -    it "return to line's page with changed name" do -      visit referential_line_path(referential,line) -      click_link "#{route.name}" -      click_link "Modifier cette séquence d'arrêts" -      fill_in "route_name", :with => "#{route.name}-changed" -      click_button("Modifier séquence d'arrêts") -      expect(page).to have_content("#{route.name}-changed") -    end -  end - -  describe "from line's page, select a route and delete it" do -    it "return to line's page without route name" do -      visit referential_line_path(referential,line) -      click_link "#{route.name}" -      click_link "Supprimer cette séquence d'arrêts" -      expect(page).not_to have_content(route.name) -    end -  end - -  describe "from route's page, select edit boarding/alighting and update it" do -    it "Edits boarding/alighting properties on route stops" do -      visit referential_line_route_path(referential, line, route) -      click_link I18n.t('routes.actions.edit_boarding_alighting') -      expect(page).to have_content(I18n.t('routes.edit_boarding_alighting.title')) -      stop_points.each do |sp| -        expect(page).to have_content(sp.stop_area.name) -        expect(page).to have_content(sp.for_boarding) -        expect(page).to have_content(sp.for_alighting) -      end -    end -  end -    describe "Modifies boarding/alighting properties on route stops" do      it "Puts (http) an update request" do        #visit edit_boarding_alighting_referential_line_route_path(referential, line, route) diff --git a/spec/models/organisation_spec.rb b/spec/models/organisation_spec.rb index c0aba2eb8..823ee7ea6 100644 --- a/spec/models/organisation_spec.rb +++ b/spec/models/organisation_spec.rb @@ -36,7 +36,7 @@ describe Organisation, :type => :model do      it 'should retrieve functional scope' do        Organisation.portail_sync        org = Organisation.find_by(code: 'RATP') -      expect(org.sso_attributes['functional_scope']).to eq "[STIF:CODIFLIGNE:Line:C00840, STIF:CODIFLIGNE:Line:C00086]" +      expect(org.sso_attributes['functional_scope']).to eq "[\"STIF:CODIFLIGNE:Line:C00840\", \"STIF:CODIFLIGNE:Line:C00086\"]"      end      it 'should update existing organisations' do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index c20e80ca1..bb43be63e 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -36,7 +36,7 @@ describe User, :type => :model do        it 'should store organisation functional_scope' do          User.authenticate_with_cas_ticket(ticket)          org = Organisation.find_by(code: ticket.extra_attributes[:organisation_code]) -        expect(org.sso_attributes['functional_scope']).to eq "[STIF:CODIFLIGNE:Line:C00840, STIF:CODIFLIGNE:Line:C00086]" +        expect(org.sso_attributes['functional_scope']).to eq "[\"STIF:CODIFLIGNE:Line:C00840\", \"STIF:CODIFLIGNE:Line:C00086\"]"        end        it 'should not create a new organisation if organisation is already present' do diff --git a/spec/models/workbench_spec.rb b/spec/models/workbench_spec.rb index 023a65ea2..84149ddb0 100644 --- a/spec/models/workbench_spec.rb +++ b/spec/models/workbench_spec.rb @@ -1,7 +1,6 @@  require 'rails_helper'  RSpec.describe Workbench, :type => :model do -    it 'should have a valid factory' do      expect(FactoryGirl.build(:workbench)).to be_valid    end @@ -12,4 +11,26 @@ RSpec.describe Workbench, :type => :model do    it { should belong_to(:organisation) }    it { should belong_to(:line_referential) }    it { should belong_to(:stop_area_referential) } + +  it { should have_many(:lines).through(:line_referential) } +  it { should have_many(:networks).through(:line_referential) } +  it { should have_many(:companies).through(:line_referential) } +  it { should have_many(:group_of_lines).through(:line_referential) } + +  it { should have_many(:stop_areas).through(:stop_area_referential) } + +  context '.lines' do +    let!(:ids) { ['STIF:CODIFLIGNE:Line:C00840', 'STIF:CODIFLIGNE:Line:C00086'] } +    let!(:organisation) { create :organisation, sso_attributes: { functional_scope: ids.to_json } } +    let(:workbench) { create :workbench, organisation: organisation } + +    it 'should filter lines based on my organisation functional_scope' do +      ids.insert('STIF:CODIFLIGNE:Line:0000').each do |id| +        create :line, objectid: id, line_referential: workbench.line_referential +      end +      lines = workbench.lines +      expect(lines.count).to eq 2 +      expect(lines.map(&:objectid)).to include(*ids) +    end +  end  end | 
