diff options
| author | Alban Peignier | 2018-01-11 15:32:07 +0100 |
|---|---|---|
| committer | Alban Peignier | 2018-01-11 15:32:07 +0100 |
| commit | b56d9e01cf1e8a0cf50c597c863c2b775b7a322d (patch) | |
| tree | f1f9394b9ab64855ccfb9a3addcd89aea474a8d1 | |
| parent | d1b6592497f365d5982be84085fa8dabfd4a6b1b (diff) | |
| download | chouette-core-b56d9e01cf1e8a0cf50c597c863c2b775b7a322d.tar.bz2 | |
Fixes Chouette::RoutingConstraintZone#route_id presence spec. Refs #5552
| -rw-r--r-- | app/models/chouette/routing_constraint_zone.rb | 2 | ||||
| -rw-r--r-- | spec/models/chouette/routing_constraint_zone_spec.rb | 7 |
2 files changed, 2 insertions, 7 deletions
diff --git a/app/models/chouette/routing_constraint_zone.rb b/app/models/chouette/routing_constraint_zone.rb index 1847f6e25..903922241 100644 --- a/app/models/chouette/routing_constraint_zone.rb +++ b/app/models/chouette/routing_constraint_zone.rb @@ -7,7 +7,7 @@ module Chouette belongs_to :route has_array_of :stop_points, class_name: 'Chouette::StopPoint' - validates_presence_of :name, :stop_points, :route, :route_id + validates_presence_of :name, :stop_points, :route_id # validates :stop_point_ids, length: { minimum: 2, too_short: I18n.t('activerecord.errors.models.routing_constraint_zone.attributes.stop_points.not_enough_stop_points') } validate :stop_points_belong_to_route, :not_all_stop_points_selected diff --git a/spec/models/chouette/routing_constraint_zone_spec.rb b/spec/models/chouette/routing_constraint_zone_spec.rb index 8ebd8695c..0282cb8b1 100644 --- a/spec/models/chouette/routing_constraint_zone_spec.rb +++ b/spec/models/chouette/routing_constraint_zone_spec.rb @@ -5,6 +5,7 @@ describe Chouette::RoutingConstraintZone, type: :model do subject { create(:routing_constraint_zone) } it { is_expected.to validate_presence_of :name } + it { is_expected.to validate_presence_of :route_id } # shoulda matcher to validate length of array ? xit { is_expected.to validate_length_of(:stop_point_ids).is_at_least(2) } it { is_expected.to be_versioned } @@ -14,12 +15,6 @@ describe Chouette::RoutingConstraintZone, type: :model do end describe 'validations' do - it 'validates the presence of route_id' do - expect { - subject.update!(route_id: nil) - }.to raise_error(NoMethodError) - end - it 'validates the presence of stop_point_ids' do expect { subject.update!(stop_point_ids: []) |
