aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/referential_spec.rb
diff options
context:
space:
mode:
authorMichel Etienne2013-06-28 15:41:57 +0200
committerMichel Etienne2013-06-28 15:41:57 +0200
commit3529f9d5f2851b65fcf94b5a4ec3b722b9f6c64c (patch)
treeeab7c9adfda90b4e06ddd06716e98da65bd4b3aa /spec/models/referential_spec.rb
parente8bf323e77a548e3ea7e9ab8e1e13e90764046c4 (diff)
downloadchouette-core-3529f9d5f2851b65fcf94b5a4ec3b722b9f6c64c.tar.bz2
remove projection attributes from stop areas and access points in database
Diffstat (limited to 'spec/models/referential_spec.rb')
-rw-r--r--spec/models/referential_spec.rb56
1 files changed, 56 insertions, 0 deletions
diff --git a/spec/models/referential_spec.rb b/spec/models/referential_spec.rb
index bb6158d4f..daee718d5 100644
--- a/spec/models/referential_spec.rb
+++ b/spec/models/referential_spec.rb
@@ -7,4 +7,60 @@ describe Referential do
it { should validate_presence_of(:prefix) }
it { should validate_presence_of(:time_zone) }
+end
+
+describe Chouette::StopArea do
+ # check override methods
+
+ subject {Factory(:stop_area)}
+
+ it "should return referential projection " do
+ subject.referential.projection_type='27572'
+ subject.projection.should == subject.referential.projection_type
+ end
+
+ it "should return projection coordinates when referential has projection" do
+ subject.latitude = 45
+ subject.longitude = 0
+ subject.referential.projection_type='27572'
+ subject.projection_x.should_not be_nil
+ subject.projection_y.should_not be_nil
+ end
+
+ it "should return nil projection coordinates when referential has no projection" do
+ subject.latitude = 45
+ subject.longitude = 0
+ subject.referential.projection_type=nil
+ subject.projection_x.should be_nil
+ subject.projection_y.should be_nil
+ end
+
+end
+
+describe Chouette::AccessPoint do
+ # check override methods
+
+ subject {Factory(:access_point)}
+
+ it "should return referential projection " do
+ subject.referential.projection_type='27572'
+ subject.projection.should == subject.referential.projection_type
+ end
+
+ it "should return projection coordinates when referential has projection" do
+ subject.latitude = 45
+ subject.longitude = 0
+ subject.referential.projection_type='27572'
+ subject.projection_x.should_not be_nil
+ subject.projection_y.should_not be_nil
+ end
+
+ it "should return nil projection coordinates when referential has no projection" do
+ subject.latitude = 45
+ subject.longitude = 0
+ subject.referential.projection_type=nil
+ subject.projection_x.should be_nil
+ subject.projection_y.should be_nil
+ end
+
end \ No newline at end of file