diff options
| author | Robert | 2017-11-27 10:07:30 +0100 |
|---|---|---|
| committer | Robert | 2017-12-14 15:34:46 +0100 |
| commit | 695d6604f12515507e2e8d435370d30df5fc820d (patch) | |
| tree | afbb8919268ea2a5cd96b232d64eb7dbc108de34 /spec | |
| parent | 1eacdd594ec0079372c7e8d0c32d283e2a20a05c (diff) | |
| download | chouette-core-695d6604f12515507e2e8d435370d30df5fc820d.tar.bz2 | |
Refs: #5006@3h;
Working out how to check for allowed lines vs. foreign lines
- Implement allowed_lines as `Organisation#lines_set`
- Pushed line_id related stuff into `lib/stif/codif_line_id.rb`
- Related Specs
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/factories/organisations.rb | 3 | ||||
| -rw-r--r-- | spec/models/organisation_spec.rb | 15 |
2 files changed, 16 insertions, 2 deletions
diff --git a/spec/factories/organisations.rb b/spec/factories/organisations.rb index 239557a0e..2914c30cb 100644 --- a/spec/factories/organisations.rb +++ b/spec/factories/organisations.rb @@ -2,5 +2,8 @@ FactoryGirl.define do factory :organisation do sequence(:name) { |n| "Organisation #{n}" } sequence(:code) { |n| "000#{n}" } + factory :org_with_lines do + sso_attributes { { 'functional_scope' => %w{STIF:CODIFLIGNE:Line:C00108 STIF:CODIFLIGNE:Line:C00109}.to_json } } + end end end diff --git a/spec/models/organisation_spec.rb b/spec/models/organisation_spec.rb index 1217666f7..359417d88 100644 --- a/spec/models/organisation_spec.rb +++ b/spec/models/organisation_spec.rb @@ -2,8 +2,19 @@ describe Organisation, :type => :model do it { should validate_presence_of(:name) } it { should validate_uniqueness_of(:code) } - it 'should have a valid factory' do - expect(FactoryGirl.build(:organisation)).to be_valid + subject { build_stubbed :organisation } + + it 'has a valid factory' do + expect_it.to be_valid + end + + context 'lines_set' do + it 'has no lines' do + expect( subject.lines_set ).to eq(Set.new()) + end + it 'has two lines' do + expect( build_stubbed(:org_with_lines).lines_set ).to eq(Set.new(%w{C00109 C00108})) + end end # it "create a rule_parameter_set" do |
