aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/concerns
diff options
context:
space:
mode:
authorcedricnjanga2017-11-23 17:14:05 +0100
committercedricnjanga2017-11-23 17:14:05 +0100
commit0a9b5cd19dc52e00c9516e2a4cf204580d889862 (patch)
tree265d7db92bd9d2b560c0856b9c9f2f5b5b8ae81d /spec/models/concerns
parentcf72b3c73db85b1a5b7c2381c3afddd98290691d (diff)
downloadchouette-core-0a9b5cd19dc52e00c9516e2a4cf204580d889862.tar.bz2
Add spec for stif_netex objectid_format
Diffstat (limited to 'spec/models/concerns')
-rw-r--r--spec/models/concerns/objectid_support_spec.rb88
1 files changed, 88 insertions, 0 deletions
diff --git a/spec/models/concerns/objectid_support_spec.rb b/spec/models/concerns/objectid_support_spec.rb
new file mode 100644
index 000000000..656e42d8e
--- /dev/null
+++ b/spec/models/concerns/objectid_support_spec.rb
@@ -0,0 +1,88 @@
+RSpec.describe ObjectidSupport do
+
+ context 'when referential has an objectid format of stif_netex' do
+ let(:route) { create(:route_with_after_commit, objectid: nil) }
+
+ context "#objectid_format" do
+ it "should be stif_netex" do
+ expect(route.objectid_format).to eq('stif_netex')
+ end
+
+ it "should be the same as the referential" do
+ expect(route.objectid_format).to eq(route.referential.objectid_format)
+ end
+ end
+
+ context "#get_objectid" do
+ let(:objectid) { route.get_objectid }
+ it "should be valid" do
+ expect(objectid).to be_valid
+ end
+
+ it "should have the same local id than the object" do
+ expect(objectid.local_id).to eq(route.local_id)
+ end
+
+ it "should be a Chouette::Objectid::StifNetex" do
+ expect(objectid).to be_kind_of(Chouette::Objectid::StifNetex)
+ end
+
+ context "#to_s" do
+ it "should return a string" do
+ expect(objectid.to_s).to be_kind_of(String)
+ end
+
+ it "should be the same as the db attribute" do
+ expect(objectid.to_s).to eq(route.read_attribute(:objectid))
+ expect(objectid.to_s).to eq(route.objectid)
+ end
+ end
+ end
+ end
+
+ # context 'when referential has an objectid format of netex' do
+ # let(:line) { create(:route_with_after_commit, objectid: nil) }
+
+ # before(:all) do
+ # binding.pry
+ # route.referential.objectid_format = 'netex'
+ # end
+
+ # context "#objectid_format" do
+ # it "should be netex" do
+ # expect(route.objectid_format).to eq('netex')
+ # end
+ # it "should be the same as the referential" do
+ # expect(route.objectid_format).to eq(route.referential.objectid_format)
+ # end
+ # end
+
+ # context "#get_objectid" do
+ # let(:objectid) { route.get_objectid }
+ # it "should be valid" do
+ # expect(objectid).to be_valid
+ # end
+
+ # it "should have the same local id than the object" do
+ # expect(objectid.local_id).to eq(route.local_id)
+ # end
+
+ # it "should be a Chouette::Objectid::Netex" do
+ # expect(objectid).to be_kind_of(Chouette::Objectid::Netex)
+ # end
+
+ # context "#to_s" do
+ # it "should return a string" do
+ # expect(objectid.to_s).to be_kind_of(String)
+ # end
+
+ # it "should be the same as the db attribute" do
+ # expect(objectid.to_s).to eq(route.read_attribute(:objectid))
+ # expect(objectid.to_s).to eq(route.objectid)
+ # end
+ # end
+ # end
+ # end
+
+
+end \ No newline at end of file