diff options
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 - | 
