diff options
| author | Alban Peignier | 2016-05-13 11:56:54 +0200 |
|---|---|---|
| committer | Alban Peignier | 2016-05-13 11:56:54 +0200 |
| commit | 6e28e49262ede9c57a6c5726570a4921f4b63d04 (patch) | |
| tree | 31a26a03e2c1dd3af796c9854918d112ad6e97c8 /spec/models/line_spec.rb | |
| parent | 781142afdb90bb0ca62783435f582725794f4f57 (diff) | |
| download | chouette-core-6e28e49262ede9c57a6c5726570a4921f4b63d04.tar.bz2 | |
Refactor models and controllers to manage Lines in LineReferential. Refs #825
Diffstat (limited to 'spec/models/line_spec.rb')
| -rw-r--r-- | spec/models/line_spec.rb | 53 |
1 files changed, 2 insertions, 51 deletions
diff --git a/spec/models/line_spec.rb b/spec/models/line_spec.rb index 024bfac07..259c7035a 100644 --- a/spec/models/line_spec.rb +++ b/spec/models/line_spec.rb @@ -1,58 +1,9 @@ require 'spec_helper' -describe "sdflkjskdjf" do +describe Chouette::Line, type: :model do subject { create(:line) } - def set_large_object_id( line) - line.update_attributes :objectid => "AA:Line:123456789012345" - end + it { is_expected.to belong_to(:line_referential) } - describe "validation objectid unique constraint" do - let(:referential){subject.referential} - let(:objectid_a){ "A:Line:1234" } - let(:objectid_b){ "B:Line:1234" } - let!(:second_line){ create( :line, :objectid => objectid_a, :registration_number => "123456") } - context "when referential works with HUB" do - before( :each) do - referential.update_attributes :data_format => "hub" - subject.update_attributes :objectid => objectid_a - end - it "should have objectid with a third part shorter than 14 char" do - subject.update_attributes :objectid => objectid_b - subject.should_not be_valid - end - end - context "when referential doesn't works with HUB" do - before( :each) do - referential.update_attributes :data_format => "hub" - end - #it "should have objectid with a third part shorter than 14 char" do - # subject.update_attributes :objectid => objectid_b, :registration_number => '324' - # subject.should be_valid - #end - end - end - describe "validation objectid size" do - let(:referential){subject.referential} - context "when referential works with HUB" do - before( :each) do - referential.update_attributes :data_format => "hub" - end - it "should have objectid with a third part shorter than 14 char" do - set_large_object_id( subject) - subject.should_not be_valid - end - end - context "when referential doesn't works with HUB" do - before( :each) do - referential.update_attributes :data_format => "hub" - end - #it "should have objectid with a third part shorter than 14 char" do - # set_large_object_id( subject) - # subject.should be_valid - #end - end - end end - |
