ninoxe 0.1.6 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. data/app/models/chouette/command.rb +3 -2
  2. data/app/models/chouette/route.rb +12 -11
  3. data/app/models/chouette/stop_point.rb +11 -5
  4. data/app/models/chouette/time_table.rb +19 -7
  5. data/app/models/chouette/time_table_date.rb +8 -1
  6. data/app/models/chouette/time_table_period.rb +6 -1
  7. data/app/models/chouette/trident_active_record.rb +12 -0
  8. data/config/database.yml +2 -0
  9. data/{spec/dummy/config/database.yml → config/database.yml.me} +2 -0
  10. data/lib/ninoxe/version.rb +1 -1
  11. data/lib/ninoxe.rb~ +7 -0
  12. metadata +131 -209
  13. checksums.yaml +0 -7
  14. data/spec/dummy/README.rdoc +0 -261
  15. data/spec/dummy/Rakefile +0 -6
  16. data/spec/dummy/app/assets/javascripts/application.js +0 -15
  17. data/spec/dummy/app/assets/stylesheets/application.css +0 -13
  18. data/spec/dummy/app/controllers/application_controller.rb +0 -3
  19. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  20. data/spec/dummy/app/mailers/.gitkeep +0 -0
  21. data/spec/dummy/app/models/.gitkeep +0 -0
  22. data/spec/dummy/app/views/layouts/application.html.erb +0 -14
  23. data/spec/dummy/config/application.rb +0 -56
  24. data/spec/dummy/config/boot.rb +0 -10
  25. data/spec/dummy/config/environment.rb +0 -7
  26. data/spec/dummy/config/environments/development.rb +0 -37
  27. data/spec/dummy/config/environments/production.rb +0 -67
  28. data/spec/dummy/config/environments/test.rb +0 -37
  29. data/spec/dummy/config/initializers/active_record.rb +0 -2
  30. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  31. data/spec/dummy/config/initializers/inflections.rb +0 -15
  32. data/spec/dummy/config/initializers/mime_types.rb +0 -5
  33. data/spec/dummy/config/initializers/secret_token.rb +0 -7
  34. data/spec/dummy/config/initializers/session_store.rb +0 -8
  35. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  36. data/spec/dummy/config/locales/en.yml +0 -5
  37. data/spec/dummy/config/routes.rb +0 -4
  38. data/spec/dummy/config.ru +0 -4
  39. data/spec/dummy/db/test.sqlite3 +0 -0
  40. data/spec/dummy/lib/assets/.gitkeep +0 -0
  41. data/spec/dummy/log/.gitkeep +0 -0
  42. data/spec/dummy/public/404.html +0 -26
  43. data/spec/dummy/public/422.html +0 -26
  44. data/spec/dummy/public/500.html +0 -25
  45. data/spec/dummy/public/favicon.ico +0 -0
  46. data/spec/dummy/script/rails +0 -6
  47. data/spec/models/chouette/access_link_spec.rb +0 -78
  48. data/spec/models/chouette/access_point_spec.rb +0 -193
  49. data/spec/models/chouette/active_record_spec.rb +0 -121
  50. data/spec/models/chouette/area_type_spec.rb +0 -53
  51. data/spec/models/chouette/company_spec.rb +0 -51
  52. data/spec/models/chouette/connection_link_spec.rb +0 -56
  53. data/spec/models/chouette/direction_spec.rb +0 -60
  54. data/spec/models/chouette/exporter_spec.rb +0 -28
  55. data/spec/models/chouette/file_validator_spec.rb +0 -28
  56. data/spec/models/chouette/group_of_line_spec.rb +0 -31
  57. data/spec/models/chouette/journey_pattern_spec.rb +0 -62
  58. data/spec/models/chouette/line_spec.rb +0 -106
  59. data/spec/models/chouette/loader_spec.rb +0 -69
  60. data/spec/models/chouette/network_spec.rb +0 -22
  61. data/spec/models/chouette/object_id_spec.rb +0 -146
  62. data/spec/models/chouette/route_spec.rb +0 -159
  63. data/spec/models/chouette/stop_area_spec.rb +0 -354
  64. data/spec/models/chouette/stop_point_spec.rb +0 -39
  65. data/spec/models/chouette/time_table_spec.rb +0 -372
  66. data/spec/models/chouette/transport_mode_spec.rb +0 -64
  67. data/spec/models/chouette/vehicle_journey_at_stop_spec.rb +0 -46
  68. data/spec/models/chouette/vehicle_journey_spec.rb +0 -204
  69. data/spec/presenters/chouette/geometry/general_presenter.rb +0 -1
  70. data/spec/presenters/chouette/geometry/line_presenter_spec.rb +0 -13
  71. data/spec/spec_helper.rb +0 -45
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/404.html -->
21
- <div class="dialog">
22
- <h1>The page you were looking for doesn't exist.</h1>
23
- <p>You may have mistyped the address or the page may have moved.</p>
24
- </div>
25
- </body>
26
- </html>
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/422.html -->
21
- <div class="dialog">
22
- <h1>The change you wanted was rejected.</h1>
23
- <p>Maybe you tried to change something you didn't have access to.</p>
24
- </div>
25
- </body>
26
- </html>
@@ -1,25 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/500.html -->
21
- <div class="dialog">
22
- <h1>We're sorry, but something went wrong.</h1>
23
- </div>
24
- </body>
25
- </html>
File without changes
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby1.8
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- APP_PATH = File.expand_path('../../config/application', __FILE__)
5
- require File.expand_path('../../config/boot', __FILE__)
6
- require 'rails/commands'
@@ -1,78 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Chouette::AccessLink do
4
- subject { Factory(:access_link) }
5
-
6
- it { should validate_uniqueness_of :objectid }
7
- its(:objectid) { should be_kind_of(Chouette::ObjectId) }
8
-
9
- it { should validate_presence_of :name }
10
- it { should validate_presence_of :link_type }
11
- it { should validate_presence_of :link_orientation }
12
-
13
- describe "#access_link_type" do
14
-
15
- def self.legacy_link_types
16
- %w{Underground Mixed Overground}
17
- end
18
-
19
- legacy_link_types.each do |link_type|
20
- context "when link_type is #{link_type}" do
21
- access_link_type = Chouette::ConnectionLinkType.new(link_type.underscore)
22
- it "should be #{access_link_type}" do
23
- subject.link_type = link_type
24
- subject.access_link_type.should == access_link_type
25
- end
26
- end
27
- end
28
- end
29
-
30
- describe "#access_link_type=" do
31
-
32
- it "should change link_type with ConnectionLinkType#name" do
33
- subject.access_link_type = "underground"
34
- subject.link_type.should == "Underground"
35
- end
36
-
37
- end
38
-
39
- describe "#link_orientation_type" do
40
-
41
- def self.legacy_link_orientations
42
- %w{AccessPointToStopArea StopAreaToAccessPoint}
43
- end
44
-
45
- legacy_link_orientations.each do |link_orientation|
46
- context "when link_orientation is #{link_orientation}" do
47
- link_orientation_type = Chouette::LinkOrientationType.new(link_orientation.underscore)
48
- it "should be #{link_orientation_type}" do
49
- subject.link_orientation = link_orientation
50
- subject.link_orientation_type.should == link_orientation_type
51
- end
52
- end
53
- end
54
-
55
- end
56
-
57
- describe "#link_orientation_type=" do
58
-
59
- it "should change link_orientation with LinkOrientationType#name" do
60
- subject.link_orientation_type = "access_point_to_stop_area"
61
- subject.link_orientation.should == "AccessPointToStopArea"
62
- end
63
-
64
- end
65
-
66
- describe "#link_key" do
67
- it "should calculate link_key for access to area" do
68
- subject.link_orientation_type = "access_point_to_stop_area"
69
- subject.link_key.should == "A_#{subject.access_point.id}-S_#{subject.stop_area.id}"
70
- end
71
- it "should calculate link_key for area to access" do
72
- subject.link_orientation_type = "stop_area_to_access_point"
73
- subject.link_key.should == "S_#{subject.stop_area.id}-A_#{subject.access_point.id}"
74
- end
75
-
76
- end
77
-
78
- end
@@ -1,193 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Chouette::AccessPoint do
4
-
5
- its(:objectid) { should be_kind_of(Chouette::ObjectId) }
6
-
7
- it { should validate_presence_of :name }
8
- it { should validate_numericality_of :latitude }
9
- it { should validate_numericality_of :longitude }
10
-
11
- describe ".latitude" do
12
- it "should accept -90 value" do
13
- subject = Factory :access_point
14
- subject.latitude = -90
15
- subject.valid?.should be_true
16
- end
17
- it "should reject < -90 value" do
18
- subject = Factory :access_point
19
- subject.latitude = -90.0001
20
- subject.valid?.should be_false
21
- end
22
- it "should accept 90 value" do
23
- subject = Factory :access_point
24
- subject.latitude = 90
25
- subject.valid?.should be_true
26
- end
27
- it "should reject > 90 value" do
28
- subject = Factory :access_point
29
- subject.latitude = 90.0001
30
- subject.valid?.should be_false
31
- end
32
- end
33
-
34
- describe ".longitude" do
35
- it "should accept -180 value" do
36
- subject = Factory :access_point
37
- subject.longitude = -180
38
- subject.valid?.should be_true
39
- end
40
- it "should reject < -180 value" do
41
- subject = Factory :access_point
42
- subject.longitude = -180.0001
43
- subject.valid?.should be_false
44
- end
45
- it "should accept 180 value" do
46
- subject = Factory :access_point
47
- subject.longitude = 180
48
- subject.valid?.should be_true
49
- end
50
- it "should reject > 180 value" do
51
- subject = Factory :access_point
52
- subject.longitude = 180.0001
53
- subject.valid?.should be_false
54
- end
55
- end
56
-
57
- describe ".long_lat" do
58
- it "should accept longitude and latitude both as nil" do
59
- subject = Factory :access_point
60
- subject.longitude = nil
61
- subject.latitude = nil
62
- subject.valid?.should be_true
63
- end
64
- it "should accept longitude and latitude both numerical" do
65
- subject = Factory :access_point
66
- subject.longitude = 10
67
- subject.latitude = 10
68
- subject.valid?.should be_true
69
- end
70
- it "should reject longitude nil with latitude numerical" do
71
- subject = Factory :access_point
72
- subject.longitude = nil
73
- subject.latitude = 10
74
- subject.valid?.should be_false
75
- end
76
- it "should reject longitude numerical with latitude nil" do
77
- subject = Factory :access_point
78
- subject.longitude = 10
79
- subject.latitude = nil
80
- subject.valid?.should be_false
81
- end
82
- end
83
-
84
- describe "#access_type" do
85
- def self.legacy_access_types
86
- %w{In Out InOut}
87
- end
88
-
89
- legacy_access_types.each do |access_type|
90
- context "when access_type is #{access_type}" do
91
- access_point_type = Chouette::AccessPointType.new(access_type.underscore)
92
- it "should be #{access_point_type}" do
93
- subject.access_type = access_type
94
- subject.access_point_type.should == access_point_type
95
- end
96
- end
97
- end
98
- end
99
-
100
- describe "#access_point_type=" do
101
- it "should change access_type with Chouette::AccessPointType#name" do
102
- subject.access_point_type = "in_out"
103
- subject.access_type.should == "InOut"
104
- end
105
-
106
- end
107
-
108
- describe "#to_lat_lng" do
109
-
110
- it "should return nil if latitude is nil" do
111
- subject.latitude = nil
112
- subject.to_lat_lng.should be_nil
113
- end
114
-
115
- it "should return nil if longitude is nil" do
116
- subject.longitude = nil
117
- subject.to_lat_lng.should be_nil
118
- end
119
-
120
- end
121
-
122
- describe "#geometry" do
123
-
124
- it "should be nil when to_lat_lng is nil" do
125
- subject.stub :to_lat_lng => nil
126
- subject.geometry.should be_nil
127
- end
128
-
129
- end
130
-
131
- describe "#generic_access_link_matrix" do
132
- it "should have 2 generic_access_links in matrix" do
133
- stop_place = Factory :stop_area, :area_type => "StopPlace"
134
- commercial_stop_point = Factory :stop_area, :area_type => "CommercialStopPoint" ,:parent => stop_place
135
- subject = Factory :access_point, :stop_area => stop_place
136
- subject.generic_access_link_matrix.size.should == 2
137
- end
138
-
139
- it "should have new generic_access_links in matrix" do
140
- commercial_stop_point = Factory :stop_area, :area_type => "CommercialStopPoint"
141
- subject = Factory :access_point, :stop_area => commercial_stop_point
142
- subject.generic_access_link_matrix.each do |link|
143
- link.id.should be_nil
144
- end
145
- end
146
- it "should have only last generic_access_links as new in matrix" do
147
- commercial_stop_point = Factory :stop_area, :area_type => "CommercialStopPoint"
148
- subject = Factory :access_point, :stop_area => commercial_stop_point
149
- link = Factory :access_link, :access_point => subject, :stop_area => commercial_stop_point
150
- subject.generic_access_link_matrix.each do |link|
151
- if link.link_key.start_with?"A_"
152
- link.id.should_not be_nil
153
- else
154
- link.id.should be_nil
155
- end
156
- end
157
- end
158
- end
159
-
160
- describe "#detail_access_link_matrix" do
161
- it "should have 4 detail_access_links in matrix" do
162
- stop_place = Factory :stop_area, :area_type => "StopPlace"
163
- commercial_stop_point = Factory :stop_area, :area_type => "CommercialStopPoint" ,:parent => stop_place
164
- quay1 = Factory :stop_area, :parent => commercial_stop_point, :area_type => "Quay"
165
- quay2 = Factory :stop_area, :parent => commercial_stop_point, :area_type => "Quay"
166
- subject = Factory :access_point, :stop_area => stop_place
167
- subject.detail_access_link_matrix.size.should == 4
168
- end
169
-
170
- it "should have new detail_access_links in matrix" do
171
- commercial_stop_point = Factory :stop_area, :area_type => "CommercialStopPoint"
172
- quay = Factory :stop_area, :parent => commercial_stop_point, :area_type => "Quay"
173
- subject = Factory :access_point, :stop_area => commercial_stop_point
174
- subject.detail_access_link_matrix.each do |link|
175
- link.id.should be_nil
176
- end
177
- end
178
- it "should have only last detail_access_links as new in matrix" do
179
- commercial_stop_point = Factory :stop_area, :area_type => "CommercialStopPoint"
180
- quay = Factory :stop_area, :parent => commercial_stop_point, :area_type => "Quay"
181
- subject = Factory :access_point, :stop_area => commercial_stop_point
182
- link = Factory :access_link, :access_point => subject, :stop_area => quay
183
- subject.detail_access_link_matrix.each do |link|
184
- if link.link_key.start_with?"A_"
185
- link.id.should_not be_nil
186
- else
187
- link.id.should be_nil
188
- end
189
- end
190
- end
191
- end
192
-
193
- end
@@ -1,121 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Chouette::ActiveRecord do
4
-
5
- it { Chouette::ActiveRecord.ancestors.should include(ActiveRecord::Base) }
6
-
7
- describe "table_name" do
8
-
9
- it "should return line for Chouette::Line" do
10
- Chouette::Line.table_name.should == "lines"
11
- end
12
-
13
- it "should return ptnetwork for Chouette::Network" do
14
- Chouette::Network.table_name.should == "networks"
15
- end
16
-
17
- it "should return timetable_date for Chouette::TimeTableDate" do
18
- Chouette::TimeTableDate.table_name.should == "time_table_dates"
19
- end
20
-
21
- it "should return timetable_period for Chouette::TimeTablePeriod" do
22
- Chouette::TimeTablePeriod.table_name.should == "time_table_periods"
23
- end
24
-
25
- end
26
-
27
- describe "method_missing" do
28
-
29
- it "should support method with additionnal underscores" do
30
- stop_area = Chouette::StopArea.new
31
- stop_area.area_type.should == stop_area.area_type
32
- end
33
-
34
- end
35
-
36
-
37
- describe "respond_to?" do
38
-
39
- it "should respond to method with additionnal underscores" do
40
- stop_area = Chouette::StopArea.new
41
- stop_area.respond_to?(:area_type).should be_true
42
- end
43
-
44
- end
45
-
46
- describe "create_reflection" do
47
-
48
- let(:macro) { :has_many }
49
- let(:name) { :lines }
50
- let(:options) { {} }
51
- let(:active_record) { Chouette::Network }
52
-
53
- let(:modified_options) { {:modified => true} }
54
-
55
- it "should invoke create_reflection_without_chouette_naming with modified options" do
56
- Chouette::ActiveRecord::Reflection.stub :new => mock(:options_with_default => modified_options)
57
- Chouette::ActiveRecord.should_receive(:create_reflection_without_chouette_naming).with macro, name, modified_options, active_record
58
-
59
- Chouette::ActiveRecord.create_reflection macro, name, options, active_record
60
- end
61
-
62
- end
63
-
64
- end
65
-
66
- describe Chouette::ActiveRecord::Reflection do
67
-
68
- let(:macro) { :has_many }
69
- let(:name) { :lines }
70
- let(:options) { {} }
71
- let(:active_record) { Chouette::Network }
72
-
73
- subject { Chouette::ActiveRecord::Reflection.new macro, name, options, active_record }
74
-
75
- describe "collection?" do
76
-
77
- it "should be true when macro is has_many" do
78
- subject.stub :macro => :has_many
79
- subject.should be_collection
80
- end
81
-
82
- it "should be false when macro is belongs_to" do
83
- subject.stub :macro => :belong_to
84
- subject.should_not be_collection
85
- end
86
-
87
- end
88
-
89
- describe "class_name" do
90
-
91
- it "should be Chouette::Line when name is line" do
92
- subject.stub :name => "line"
93
- subject.class_name.should == "Chouette::Line"
94
- end
95
-
96
- it "should be Chouette::Routes when name is routes and reflection is a collection" do
97
- subject.stub :name => "routes", :collection? => true
98
- subject.class_name.should == "Chouette::Route"
99
- end
100
-
101
- end
102
-
103
-
104
- describe "options" do
105
-
106
- it "should define class_name if not" do
107
- subject.stub :options => {}, :class_name => "class_name"
108
- subject.options_with_default[:class_name].should == "class_name"
109
- end
110
-
111
- it "should not define class_name if presents" do
112
- subject.stub :options => {:class_name => "dummy"}
113
- subject.options_with_default[:class_name].should == "dummy"
114
- end
115
-
116
- end
117
-
118
-
119
- end
120
-
121
-
@@ -1,53 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Chouette::AreaType do
4
-
5
- def mode(text_code = "test", numerical_code = nil)
6
- numerical_code ||= 1 if text_code == "test"
7
- Chouette::AreaType.new(text_code, numerical_code)
8
- end
9
-
10
- describe "#to_i" do
11
-
12
- it "should return numerical code" do
13
- mode("test", 1).to_i.should == 1
14
- end
15
-
16
- end
17
-
18
- it "should return true to #test? when text code is 'test'" do
19
- mode("test").should be_test
20
- end
21
-
22
- it "should be equal when text codes are identical" do
23
- mode("test",1).should == mode("test", 2)
24
- end
25
-
26
- describe ".new" do
27
-
28
- it "should find numerical code from text code" do
29
- mode("boarding_position").to_i.should == 0
30
- end
31
-
32
- it "should find text code from numerical code" do
33
- mode(0).should == "boarding_position"
34
- end
35
-
36
- it "should accept another mode" do
37
- Chouette::AreaType.new(mode("test")).should == mode("test")
38
- end
39
-
40
- end
41
-
42
-
43
- describe ".all" do
44
-
45
- Chouette::AreaType.definitions.each do |text_code, numerical_code|
46
- it "should include a AreaType #{text_code}" do
47
- Chouette::AreaType.all.should include(Chouette::AreaType.new(text_code))
48
- end
49
- end
50
-
51
- end
52
-
53
- end
@@ -1,51 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Chouette::Company do
4
-
5
- subject { Factory(:company) }
6
-
7
- it { should validate_presence_of :registration_number }
8
- it { should validate_uniqueness_of :registration_number }
9
-
10
- it { should validate_presence_of :name }
11
-
12
- # it { should validate_presence_of :objectid }
13
- it { should validate_uniqueness_of :objectid }
14
-
15
- describe "#nullables empty" do
16
- it "should set null empty nullable attributes" do
17
- subject.organizational_unit = ''
18
- subject.operating_department_name = ''
19
- subject.code = ''
20
- subject.phone = ''
21
- subject.fax = ''
22
- subject.email = ''
23
- subject.nil_if_blank
24
- subject.organizational_unit.should be_nil
25
- subject.operating_department_name.should be_nil
26
- subject.code.should be_nil
27
- subject.phone.should be_nil
28
- subject.fax.should be_nil
29
- subject.email.should be_nil
30
- end
31
- end
32
-
33
- describe "#nullables non empty" do
34
- it "should not set null non epmty nullable attributes" do
35
- subject.organizational_unit = 'a'
36
- subject.operating_department_name = 'b'
37
- subject.code = 'c'
38
- subject.phone = 'd'
39
- subject.fax = 'z'
40
- subject.email = 'r'
41
- subject.nil_if_blank
42
- subject.organizational_unit.should_not be_nil
43
- subject.operating_department_name.should_not be_nil
44
- subject.code.should_not be_nil
45
- subject.phone.should_not be_nil
46
- subject.fax.should_not be_nil
47
- subject.email.should_not be_nil
48
- end
49
- end
50
-
51
- end
@@ -1,56 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Chouette::ConnectionLink do
4
- let!(:quay) { Factory :stop_area, :area_type => "Quay" }
5
- let!(:boarding_position) { Factory :stop_area, :area_type => "BoardingPosition" }
6
- let!(:commercial_stop_point) { Factory :stop_area, :area_type => "CommercialStopPoint" }
7
- let!(:stop_place) { Factory :stop_area, :area_type => "StopPlace" }
8
- let!(:itl) { Factory :stop_area, :area_type => "ITL" }
9
- subject { Factory(:connection_link) }
10
-
11
- it { should validate_uniqueness_of :objectid }
12
- its(:objectid) { should be_kind_of(Chouette::ObjectId) }
13
-
14
- it { should validate_presence_of :name }
15
-
16
- describe "#connection_link_type" do
17
-
18
- def self.legacy_link_types
19
- %w{Underground Mixed Overground}
20
- end
21
-
22
- legacy_link_types.each do |link_type|
23
- context "when link_type is #{link_type}" do
24
- connection_link_type = Chouette::ConnectionLinkType.new(link_type.underscore)
25
- it "should be #{connection_link_type}" do
26
- subject.link_type = link_type
27
- subject.connection_link_type.should == connection_link_type
28
- end
29
- end
30
- end
31
- context "when link_type is nil" do
32
- it "should be nil" do
33
- subject.link_type = nil
34
- subject.connection_link_type.should be_nil
35
- end
36
- end
37
-
38
- end
39
-
40
- describe "#connection_link_type=" do
41
-
42
- it "should change link_type with ConnectionLinkType#name" do
43
- subject.connection_link_type = "Test"
44
- subject.link_type.should == "Test"
45
- end
46
-
47
- end
48
-
49
- describe ".possible_areas" do
50
-
51
- it "should not find areas type ITL" do
52
- subject.possible_areas.should_not == [itl]
53
- end
54
- end
55
-
56
- end