diff options
| author | Zog | 2018-01-29 08:45:02 +0100 |
|---|---|---|
| committer | cedricnjanga | 2018-02-06 11:04:27 -0800 |
| commit | a41d3b5e861929a75c6de23150d066ba366bb577 (patch) | |
| tree | e5a94656cb037b6b8a0157d53c3e1e8760374081 /spec | |
| parent | 857e2f2319594f61436c2f2245136c303452d934 (diff) | |
| download | chouette-core-a41d3b5e861929a75c6de23150d066ba366bb577.tar.bz2 | |
Refs #5750 @1h; Manage non-commercial StopAreas
- Add a `kind` attribute
- Hide irrelevant fields in the form
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/models/chouette/stop_area_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/models/chouette/stop_area_spec.rb b/spec/models/chouette/stop_area_spec.rb index a90e5d816..32ee5a3a6 100644 --- a/spec/models/chouette/stop_area_spec.rb +++ b/spec/models/chouette/stop_area_spec.rb @@ -10,10 +10,20 @@ describe Chouette::StopArea, :type => :model do it { should belong_to(:stop_area_referential) } it { should validate_presence_of :name } + it { should validate_presence_of :kind } it { should validate_numericality_of :latitude } it { should validate_numericality_of :longitude } it { is_expected.to be_versioned } + describe "#area_type" do + it "should validate the value is correct regarding to the kind" do + expect(build(:stop_area, kind: :commercial, area_type: :gdl)).to be_valid + expect(build(:stop_area, kind: :non_commercial, area_type: :relief)).to be_valid + expect(build(:stop_area, kind: :commercial, area_type: :relief)).to_not be_valid + expect(build(:stop_area, kind: :non_commercial, area_type: :gdl)).to_not be_valid + end + end + # describe ".latitude" do # it "should accept -90 value" do # subject = create :stop_area, :area_type => "BoardingPosition" |
