aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/ninoxe_extension_spec.rb
blob: 91d259fb6a84e5ac2859ea434e60ea3cb7dbd58e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
require 'spec_helper'

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