diff options
| author | Robert | 2017-11-09 18:16:41 +0100 |
|---|---|---|
| committer | Robert | 2017-11-17 14:56:29 +0100 |
| commit | 3fba11d14fb032802ea70240e4b204e93fe5a277 (patch) | |
| tree | 49e1dfe5993a7bf9c8c863b79399e4e887eab753 /spec/models | |
| parent | 76d11c7f973867e305d6841f69c62c5fd37d65a7 (diff) | |
| download | chouette-core-3fba11d14fb032802ea70240e4b204e93fe5a277.tar.bz2 | |
Refs: #4823@4h; Fixed Transport(Sub)mode validation bug
Diffstat (limited to 'spec/models')
| -rw-r--r-- | spec/models/compliance_check_block_spec.rb | 12 | ||||
| -rw-r--r-- | spec/models/compliance_control_block_spec.rb | 10 | ||||
| -rw-r--r-- | spec/models/line_referential_spec.rb | 9 |
3 files changed, 19 insertions, 12 deletions
diff --git a/spec/models/compliance_check_block_spec.rb b/spec/models/compliance_check_block_spec.rb index 845056fac..0629a645d 100644 --- a/spec/models/compliance_check_block_spec.rb +++ b/spec/models/compliance_check_block_spec.rb @@ -2,4 +2,16 @@ RSpec.describe ComplianceCheckBlock, type: :model do it { should belong_to :compliance_check_set } it { should have_many :compliance_checks } + + it { should allow_values(*%w{bus metro rail tram funicular}).for(:transport_mode) } + it { should_not allow_values(*%w{bs mtro ril tramm Funicular}).for(:transport_mode) } + + + it { should allow_values( *%w{ demandAndResponseBus nightBus airportLinkBus highFrequencyBus expressBus + railShuttle suburbanRailway regionalRail interregionalRail }) + .for(:transport_submode) } + + it { should_not allow_values( *%w{ demandResponseBus nightus irportLinkBus highrequencyBus expressBUs + Shuttle suburban regioalRail interregion4lRail }) + .for(:transport_submode) } end diff --git a/spec/models/compliance_control_block_spec.rb b/spec/models/compliance_control_block_spec.rb index 6566baac0..4abe0ed9c 100644 --- a/spec/models/compliance_control_block_spec.rb +++ b/spec/models/compliance_control_block_spec.rb @@ -1,18 +1,20 @@ +require 'rails_helper' + RSpec.describe ComplianceControlBlock, type: :model do it { should belong_to :compliance_control_set } it { should have_many(:compliance_controls).dependent(:destroy) } it { should validate_presence_of(:transport_mode) } - xit { should allow_values(*%w{bus metro rail tram funicular}).for(:transport_mode) } - xit { should_not allow_values(*%w{bs mtro ril tramm Funicular}).for(:transport_mode) } + it { should allow_values(*%w{bus metro rail tram funicular}).for(:transport_mode) } + it { should_not allow_values(*%w{bs mtro ril tramm Funicular}).for(:transport_mode) } - xit { should allow_values( *%w{ demandAndResponseBus nightBus airportLinkBus highFrequencyBus expressBus + it { should allow_values( *%w{ demandAndResponseBus nightBus airportLinkBus highFrequencyBus expressBus railShuttle suburbanRailway regionalRail interregionalRail }) .for(:transport_submode) } - xit { should_not allow_values( *%w{ demandResponseBus nightus irportLinkBus highrequencyBus expressBUs + it { should_not allow_values( *%w{ demandResponseBus nightus irportLinkBus highrequencyBus expressBUs Shuttle suburban regioalRail interregion4lRail }) .for(:transport_submode) } end diff --git a/spec/models/line_referential_spec.rb b/spec/models/line_referential_spec.rb index 8c6cb018b..8f8714f8f 100644 --- a/spec/models/line_referential_spec.rb +++ b/spec/models/line_referential_spec.rb @@ -1,6 +1,4 @@ -require 'spec_helper' - -RSpec.describe LineReferential, :type => :model do +RSpec.describe LineReferential, type: :model do it 'should have a valid factory' do expect(FactoryGirl.build(:line_referential)).to be_valid end @@ -10,9 +8,4 @@ RSpec.describe LineReferential, :type => :model do it { is_expected.to have_many(:workbenches) } it { should validate_presence_of(:sync_interval) } - describe "#transport_modes" do - it 'returns a list of all transport modes' do - expect(FactoryGirl.create(:line_referential).class.transport_modes).to match_array(StifTransportModeEnumerations.transport_modes ) - end - end end |
