ninoxe 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/chouette/vehicle_journey_at_stop.rb +5 -5
  3. data/lib/ninoxe/version.rb +1 -1
  4. data/spec/dummy/README.rdoc +28 -0
  5. data/spec/dummy/Rakefile +6 -0
  6. data/spec/dummy/app/assets/images/.keep +0 -0
  7. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  8. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  9. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  10. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  11. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  12. data/spec/dummy/app/mailers/.keep +0 -0
  13. data/spec/dummy/app/models/.keep +0 -0
  14. data/spec/dummy/app/models/concerns/.keep +0 -0
  15. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  16. data/spec/dummy/bin/bundle +3 -0
  17. data/spec/dummy/bin/rails +4 -0
  18. data/spec/dummy/bin/rake +4 -0
  19. data/spec/dummy/config.ru +4 -0
  20. data/spec/dummy/config/application.rb +28 -0
  21. data/spec/dummy/config/boot.rb +5 -0
  22. data/spec/dummy/config/database.yml +19 -0
  23. data/spec/dummy/config/environment.rb +5 -0
  24. data/spec/dummy/config/environments/development.rb +29 -0
  25. data/spec/dummy/config/environments/production.rb +80 -0
  26. data/spec/dummy/config/environments/test.rb +36 -0
  27. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  28. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  29. data/spec/dummy/config/initializers/inflections.rb +16 -0
  30. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  31. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  32. data/spec/dummy/config/initializers/session_store.rb +3 -0
  33. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  34. data/spec/dummy/config/locales/en.yml +23 -0
  35. data/spec/dummy/config/locales/fr.yml +23 -0
  36. data/spec/dummy/config/routes.rb +4 -0
  37. data/spec/dummy/db/schema.rb +490 -0
  38. data/spec/dummy/db/test.sqlite3 +0 -0
  39. data/spec/dummy/lib/assets/.keep +0 -0
  40. data/spec/dummy/log/.keep +0 -0
  41. data/spec/dummy/public/404.html +58 -0
  42. data/spec/dummy/public/422.html +58 -0
  43. data/spec/dummy/public/500.html +57 -0
  44. data/spec/dummy/public/favicon.ico +0 -0
  45. data/spec/dummy/script/rails +6 -0
  46. data/spec/factories/chouette_access_links.rb +13 -0
  47. data/spec/factories/chouette_access_points.rb +12 -0
  48. data/spec/factories/chouette_companies.rb +9 -0
  49. data/spec/factories/chouette_connection_links.rb +13 -0
  50. data/spec/factories/chouette_footnotes.rb +10 -0
  51. data/spec/factories/chouette_group_of_lines.rb +9 -0
  52. data/spec/factories/chouette_journey_pattern.rb +40 -0
  53. data/spec/factories/chouette_lines.rb +44 -0
  54. data/spec/factories/chouette_networks.rb +9 -0
  55. data/spec/factories/chouette_routes.rb +26 -0
  56. data/spec/factories/chouette_stop_areas.rb +12 -0
  57. data/spec/factories/chouette_stop_points.rb +10 -0
  58. data/spec/factories/chouette_time_table.rb +37 -0
  59. data/spec/factories/chouette_vehicle_journey.rb +66 -0
  60. data/spec/factories/chouette_vehicle_journey_at_stop.rb +8 -0
  61. data/spec/models/chouette/access_link_spec.rb +82 -0
  62. data/spec/models/chouette/access_point_spec.rb +269 -0
  63. data/spec/models/chouette/active_record_spec.rb +121 -0
  64. data/spec/models/chouette/area_type_spec.rb +53 -0
  65. data/spec/models/chouette/company_spec.rb +48 -0
  66. data/spec/models/chouette/connection_link_spec.rb +60 -0
  67. data/spec/models/chouette/direction_spec.rb +60 -0
  68. data/spec/models/chouette/exporter_spec.rb +28 -0
  69. data/spec/models/chouette/file_validator_spec.rb +28 -0
  70. data/spec/models/chouette/footnote_spec.rb +9 -0
  71. data/spec/models/chouette/group_of_line_spec.rb +31 -0
  72. data/spec/models/chouette/journey_pattern_spec.rb +64 -0
  73. data/spec/models/chouette/line_spec.rb +120 -0
  74. data/spec/models/chouette/loader_spec.rb +69 -0
  75. data/spec/models/chouette/network_spec.rb +19 -0
  76. data/spec/models/chouette/object_id_spec.rb +149 -0
  77. data/spec/models/chouette/route_spec.rb +238 -0
  78. data/spec/models/chouette/stop_area_spec.rb +443 -0
  79. data/spec/models/chouette/stop_point_spec.rb +41 -0
  80. data/spec/models/chouette/time_table_period_spec.rb +66 -0
  81. data/spec/models/chouette/time_table_spec.rb +1266 -0
  82. data/spec/models/chouette/transport_mode_spec.rb +64 -0
  83. data/spec/models/chouette/trident_active_record_spec.rb +115 -0
  84. data/spec/models/chouette/vehicle_journey_at_stop_spec.rb +47 -0
  85. data/spec/models/chouette/vehicle_journey_spec.rb +223 -0
  86. data/spec/presenters/chouette/geometry/general_presenter.rb +1 -0
  87. data/spec/presenters/chouette/geometry/line_presenter_spec.rb +13 -0
  88. data/spec/spec_helper.rb +58 -0
  89. metadata +178 -10
  90. data/config/database.yml.me +0 -11
  91. data/lib/ninoxe.rb~ +0 -7
@@ -0,0 +1,64 @@
1
+ require 'spec_helper'
2
+
3
+ describe Chouette::TransportMode, :type => :model do
4
+
5
+ def mode(text_code = "test", numerical_code = nil)
6
+ numerical_code ||= 1 if text_code == "test"
7
+ Chouette::TransportMode.new(text_code, numerical_code)
8
+ end
9
+
10
+ describe "#to_i" do
11
+
12
+ it "should return numerical code" do
13
+ expect(mode("test", 1).to_i).to eq(1)
14
+ end
15
+
16
+ end
17
+
18
+ it "should return true to #test? when text code is 'test'" do
19
+ expect(mode("test")).to be_test
20
+ end
21
+
22
+ it "should be equal when text codes are identical" do
23
+ expect(mode("test",1)).to eq(mode("test", 2))
24
+ end
25
+
26
+ describe ".new" do
27
+
28
+ it "should find numerical code from text code" do
29
+ expect(mode("unknown").to_i).to eq(0)
30
+ end
31
+
32
+ it "should find text code from numerical code" do
33
+ expect(mode(0)).to be_unknown
34
+ end
35
+
36
+ it "should accept another mode" do
37
+ expect(Chouette::TransportMode.new(mode("test"))).to eq(mode("test"))
38
+ end
39
+
40
+ end
41
+
42
+ describe "#public_transport?" do
43
+
44
+ it "should return false for interchange" do
45
+ expect(mode("interchange")).not_to be_public_transport
46
+ end
47
+
48
+ it "should return true for other modes" do
49
+ expect(mode("unknown")).to be_public_transport
50
+ end
51
+
52
+ end
53
+
54
+ describe ".all" do
55
+
56
+ Chouette::TransportMode.definitions.each do |text_code, numerical_code|
57
+ it "should include a TransportMode #{text_code}" do
58
+ expect(Chouette::TransportMode.all).to include(Chouette::TransportMode.new(text_code))
59
+ end
60
+ end
61
+
62
+ end
63
+
64
+ end
@@ -0,0 +1,115 @@
1
+ require 'spec_helper'
2
+
3
+ describe Chouette::TridentActiveRecord, :type => :model do
4
+
5
+ it { expect(Chouette::TridentActiveRecord.ancestors).to include(Chouette::ActiveRecord) }
6
+
7
+ subject { create(:time_table) }
8
+
9
+ describe "#uniq_objectid" do
10
+
11
+ it "should rebuild objectid" do
12
+ tm = create(:time_table)
13
+ tm.objectid = subject.objectid
14
+ tm.uniq_objectid
15
+ expect(tm.objectid).to eq(subject.objectid+"_1")
16
+ end
17
+
18
+ it "should rebuild objectid" do
19
+ tm = create(:time_table)
20
+ tm.objectid = subject.objectid
21
+ tm.uniq_objectid
22
+ tm.save
23
+ tm = create(:time_table)
24
+ tm.objectid = subject.objectid
25
+ tm.uniq_objectid
26
+ expect(tm.objectid).to eq(subject.objectid+"_2")
27
+ end
28
+
29
+ end
30
+
31
+ describe "#prepare_auto_columns" do
32
+
33
+ it "should left objectid" do
34
+ tm = Chouette::TimeTable.new :comment => "merge1" , :objectid => "NINOXE:Timetable:merge1"
35
+ tm.prepare_auto_columns
36
+ expect(tm.objectid).to eq("NINOXE:Timetable:merge1")
37
+ end
38
+
39
+ it "should add pending_id to objectid" do
40
+ tm = Chouette::TimeTable.new :comment => "merge1"
41
+ tm.prepare_auto_columns
42
+ expect(tm.objectid.start_with?("NINOXE:Timetable:__pending_id__")).to be_truthy
43
+ end
44
+
45
+ it "should set id to objectid" do
46
+ tm = Chouette::TimeTable.new :comment => "merge1"
47
+ tm.save
48
+ expect(tm.objectid).to eq("NINOXE:Timetable:"+tm.id.to_s)
49
+ end
50
+
51
+ it "should detect objectid conflicts" do
52
+ tm = Chouette::TimeTable.new :comment => "merge1"
53
+ tm.save
54
+ tm.objectid = "NINOXE:Timetable:"+(tm.id+1).to_s
55
+ tm.save
56
+ tm = Chouette::TimeTable.new :comment => "merge1"
57
+ tm.save
58
+ expect(tm.objectid).to eq("NINOXE:Timetable:"+tm.id.to_s+"_1")
59
+ end
60
+
61
+ end
62
+
63
+ describe "objectid" do
64
+
65
+ it "should build automatic objectid when empty" do
66
+ g1 = Chouette::GroupOfLine.new( :name => "g1")
67
+ g1.save
68
+ expect(g1.objectid).to eq("NINOXE:GroupOfLine:"+g1.id.to_s)
69
+ end
70
+
71
+ it "should build automatic objectid with fixed when only suffix given" do
72
+ g1 = Chouette::GroupOfLine.new( :name => "g1")
73
+ g1.objectid = "toto"
74
+ g1.save
75
+ expect(g1.objectid).to eq("NINOXE:GroupOfLine:toto")
76
+ end
77
+
78
+ it "should build automatic objectid with extension when already exists" do
79
+ g1 = Chouette::GroupOfLine.new( :name => "g1")
80
+ g1.save
81
+ cnt = g1.id + 1
82
+ g1.objectid = "NINOXE:GroupOfLine:"+cnt.to_s
83
+ g1.save
84
+ g2 = Chouette::GroupOfLine.new( :name => "g2")
85
+ g2.save
86
+ expect(g2.objectid).to eq("NINOXE:GroupOfLine:"+g2.id.to_s+"_1")
87
+ end
88
+
89
+ it "should build automatic objectid with extension when already exists" do
90
+ g1 = Chouette::GroupOfLine.new( :name => "g1")
91
+ g1.save
92
+ cnt = g1.id + 2
93
+ g1.objectid = "NINOXE:GroupOfLine:"+cnt.to_s
94
+ g1.save
95
+ g2 = Chouette::GroupOfLine.new( :name => "g2")
96
+ g2.objectid = "NINOXE:GroupOfLine:"+cnt.to_s+"_1"
97
+ g2.save
98
+ g3 = Chouette::GroupOfLine.new( :name => "g3")
99
+ g3.save
100
+ expect(g3.objectid).to eq("NINOXE:GroupOfLine:"+g3.id.to_s+"_2")
101
+ end
102
+
103
+ it "should build automatic objectid when id cleared" do
104
+ g1 = Chouette::GroupOfLine.new( :name => "g1")
105
+ g1.objectid = "NINOXE:GroupOfLine:xxxx"
106
+ g1.save
107
+ g1.objectid = nil
108
+ g1.save
109
+ expect(g1.objectid).to eq("NINOXE:GroupOfLine:"+g1.id.to_s)
110
+ end
111
+ end
112
+
113
+ end
114
+
115
+
@@ -0,0 +1,47 @@
1
+ require 'spec_helper'
2
+ require 'pp'
3
+
4
+ describe Chouette::VehicleJourneyAtStop, :type => :model do
5
+ let!(:vehicle_journey) { create(:vehicle_journey_odd)}
6
+ subject { vehicle_journey.vehicle_journey_at_stops.first }
7
+
8
+ describe "#exceeds_gap?" do
9
+ it "should return false if gap < 1.hour" do
10
+ t1 = 1.minutes.ago
11
+ t2 = 1.minutes.ago + 3.hour
12
+ expect(subject.exceeds_gap?(t1, t2)).to be_truthy
13
+ end
14
+ it "should return false if gap > 2.hour" do
15
+ t1 = 1.minutes.ago
16
+ t2 = 1.minutes.ago + 3.minutes
17
+ expect(subject.exceeds_gap?(t1, t2)).to be_falsey
18
+ end
19
+ end
20
+
21
+ describe "#increasing_times_validate" do
22
+ let(:vjas1){ vehicle_journey.vehicle_journey_at_stops[0]}
23
+ let(:vjas2){ vehicle_journey.vehicle_journey_at_stops[1]}
24
+ context "when vjas#arrival_time exceeds gap" do
25
+ it "should add errors on arrival_time" do
26
+ vjas1.arrival_time = vjas2.arrival_time - 3.hour
27
+ expect(vjas2.increasing_times_validate(vjas1)).to be_falsey
28
+ expect(vjas2.errors).not_to be_empty
29
+ expect(vjas2.errors[:arrival_time]).not_to be_blank
30
+ end
31
+ end
32
+ context "when vjas#departure_time exceeds gap" do
33
+ it "should add errors on departure_time" do
34
+ vjas1.departure_time = vjas2.departure_time - 3.hour
35
+ expect(vjas2.increasing_times_validate(vjas1)).to be_falsey
36
+ expect(vjas2.errors).not_to be_empty
37
+ expect(vjas2.errors[:departure_time]).not_to be_blank
38
+ end
39
+ end
40
+ context "when vjas does'nt exceed gap" do
41
+ it "should not add errors" do
42
+ expect(vjas2.increasing_times_validate(vjas1)).to be_truthy
43
+ expect(vjas2.errors).to be_empty
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,223 @@
1
+ require 'spec_helper'
2
+
3
+ describe Chouette::VehicleJourney, :type => :model do
4
+ subject { create(:vehicle_journey_odd) }
5
+
6
+ describe "in_relation_to_a_journey_pattern methods" do
7
+ let!(:route) { create(:route)}
8
+ let!(:journey_pattern) { create(:journey_pattern, :route => route)}
9
+ let!(:journey_pattern_odd) { create(:journey_pattern_odd, :route => route)}
10
+ let!(:journey_pattern_even) { create(:journey_pattern_even, :route => route)}
11
+
12
+ context "when vehicle_journey is on odd stop whereas selected journey_pattern is on all stops" do
13
+ subject { create(:vehicle_journey, :route => route, :journey_pattern => journey_pattern_odd)}
14
+ describe "#extra_stops_in_relation_to_a_journey_pattern" do
15
+ it "should be empty" do
16
+ expect(subject.extra_stops_in_relation_to_a_journey_pattern( journey_pattern)).to be_empty
17
+ end
18
+ end
19
+ describe "#extra_vjas_in_relation_to_a_journey_pattern" do
20
+ it "should be empty" do
21
+ expect(subject.extra_vjas_in_relation_to_a_journey_pattern( journey_pattern)).to be_empty
22
+ end
23
+ end
24
+ describe "#missing_stops_in_relation_to_a_journey_pattern" do
25
+ it "should return even stops" do
26
+ result = subject.missing_stops_in_relation_to_a_journey_pattern( journey_pattern)
27
+ expect(result).to eq(journey_pattern_even.stop_points)
28
+ end
29
+ end
30
+ describe "#update_journey_pattern" do
31
+ it "should new_record for added vjas" do
32
+ subject.update_journey_pattern( journey_pattern)
33
+ subject.vehicle_journey_at_stops.select{ |vjas| vjas.new_record? }.each do |vjas|
34
+ expect(journey_pattern_even.stop_points).to include( vjas.stop_point)
35
+ end
36
+ end
37
+ it "should add vjas on each even stops" do
38
+ subject.update_journey_pattern( journey_pattern)
39
+ vehicle_stops = subject.vehicle_journey_at_stops.map(&:stop_point)
40
+ journey_pattern_even.stop_points.each do |sp|
41
+ expect(vehicle_stops).to include(sp)
42
+ end
43
+ end
44
+ it "should not mark any vjas as _destroy" do
45
+ subject.update_journey_pattern( journey_pattern)
46
+ expect(subject.vehicle_journey_at_stops.any?{ |vjas| vjas._destroy }).to be_falsey
47
+ end
48
+ end
49
+ end
50
+ context "when vehicle_journey is on all stops whereas selected journey_pattern is on odd stops" do
51
+ subject { create(:vehicle_journey, :route => route, :journey_pattern => journey_pattern)}
52
+ describe "#missing_stops_in_relation_to_a_journey_pattern" do
53
+ it "should be empty" do
54
+ expect(subject.missing_stops_in_relation_to_a_journey_pattern( journey_pattern_odd)).to be_empty
55
+ end
56
+ end
57
+ describe "#extra_stops_in_relation_to_a_journey_pattern" do
58
+ it "should return even stops" do
59
+ result = subject.extra_stops_in_relation_to_a_journey_pattern( journey_pattern_odd)
60
+ expect(result).to eq(journey_pattern_even.stop_points)
61
+ end
62
+ end
63
+ describe "#extra_vjas_in_relation_to_a_journey_pattern" do
64
+ it "should return vjas on even stops" do
65
+ result = subject.extra_vjas_in_relation_to_a_journey_pattern( journey_pattern_odd)
66
+ expect(result.map(&:stop_point)).to eq(journey_pattern_even.stop_points)
67
+ end
68
+ end
69
+ describe "#update_journey_pattern" do
70
+ it "should add no new vjas" do
71
+ subject.update_journey_pattern( journey_pattern_odd)
72
+ expect(subject.vehicle_journey_at_stops.any?{ |vjas| vjas.new_record? }).to be_falsey
73
+ end
74
+ it "should mark vehicle_journey_at_stops as _destroy on even stops" do
75
+ subject.update_journey_pattern( journey_pattern_odd)
76
+ subject.vehicle_journey_at_stops.each { |vjas|
77
+ expect(vjas._destroy).to eq(journey_pattern_even.stop_points.include?(vjas.stop_point))
78
+ }
79
+ end
80
+ end
81
+ end
82
+
83
+ end
84
+ context "when following departure times exceeds gap" do
85
+ describe "#increasing_times" do
86
+ before(:each) do
87
+ subject.vehicle_journey_at_stops[0].departure_time = subject.vehicle_journey_at_stops[1].departure_time - 2.hour
88
+ subject.vehicle_journey_at_stops[0].arrival_time = subject.vehicle_journey_at_stops[0].departure_time
89
+ subject.vehicle_journey_at_stops[1].arrival_time = subject.vehicle_journey_at_stops[1].departure_time
90
+ end
91
+ it "should make instance invalid" do
92
+ subject.increasing_times
93
+ expect(subject.vehicle_journey_at_stops[1].errors[:departure_time]).not_to be_blank
94
+ expect(subject).not_to be_valid
95
+ end
96
+ end
97
+ describe "#update_attributes" do
98
+ let!(:params){ {"vehicle_journey_at_stops_attributes" => {
99
+ "0"=>{"id" => subject.vehicle_journey_at_stops[0].id ,"arrival_time" => 1.minutes.ago,"departure_time" => 1.minutes.ago},
100
+ "1"=>{"id" => subject.vehicle_journey_at_stops[1].id, "arrival_time" => (1.minutes.ago + 2.hour),"departure_time" => (1.minutes.ago + 2.hour)}
101
+ }}}
102
+ it "should return false" do
103
+ expect(subject.update_attributes(params)).to be_falsey
104
+ end
105
+ it "should make instance invalid" do
106
+ subject.update_attributes(params)
107
+ expect(subject).not_to be_valid
108
+ end
109
+ it "should let first vjas without any errors" do
110
+ subject.update_attributes(params)
111
+ expect(subject.vehicle_journey_at_stops[0].errors).to be_empty
112
+ end
113
+ it "should add an error on second vjas" do
114
+ subject.update_attributes(params)
115
+ expect(subject.vehicle_journey_at_stops[1].errors[:departure_time]).not_to be_blank
116
+ end
117
+ end
118
+ end
119
+
120
+ context "#time_table_tokens=" do
121
+ let!(:tm1){create(:time_table, :comment => "TM1")}
122
+ let!(:tm2){create(:time_table, :comment => "TM2")}
123
+
124
+ it "should return associated time table ids" do
125
+ subject.update_attributes :time_table_tokens => [tm1.id, tm2.id].join(',')
126
+ expect(subject.time_tables).to include( tm1)
127
+ expect(subject.time_tables).to include( tm2)
128
+ end
129
+ end
130
+ describe "#bounding_dates" do
131
+ before(:each) do
132
+ tm1 = build(:time_table, :dates =>
133
+ [ build(:time_table_date, :date => 1.days.ago.to_date, :in_out => true),
134
+ build(:time_table_date, :date => 2.days.ago.to_date, :in_out => true) ])
135
+ tm2 = build(:time_table, :periods =>
136
+ [ build(:time_table_period, :period_start => 4.days.ago.to_date, :period_end => 3.days.ago.to_date)])
137
+ tm3 = build(:time_table)
138
+ subject.time_tables = [ tm1, tm2, tm3]
139
+ end
140
+ it "should return min date from associated calendars" do
141
+ expect(subject.bounding_dates.min).to eq(4.days.ago.to_date)
142
+ end
143
+ it "should return max date from associated calendars" do
144
+ expect(subject.bounding_dates.max).to eq(1.days.ago.to_date)
145
+ end
146
+ end
147
+ context "#vehicle_journey_at_stops" do
148
+ it "should be ordered like stop_points on route" do
149
+ route = subject.route
150
+ vj_stop_ids = subject.vehicle_journey_at_stops.map(&:stop_point_id)
151
+ expected_order = route.stop_points.map(&:id).select {|s_id| vj_stop_ids.include?(s_id)}
152
+
153
+ expect(vj_stop_ids).to eq(expected_order)
154
+ end
155
+
156
+ end
157
+
158
+ describe "#transport_mode_name" do
159
+
160
+ def self.legacy_transport_modes
161
+ %w{Air Train LongDistanceTrain LocalTrain RapidTransit Metro Tramway Coach Bus Ferry Waterborne PrivateVehicle Walk Trolleybus Bicycle Shuttle Taxi VAL Other}
162
+ end
163
+
164
+ legacy_transport_modes.each do |transport_mode|
165
+ context "when transport_mode is #{transport_mode}" do
166
+ transport_mode_name = Chouette::TransportMode.new(transport_mode.underscore)
167
+ it "should be #{transport_mode_name}" do
168
+ subject.transport_mode = transport_mode
169
+ expect(subject.transport_mode_name).to eq(transport_mode_name)
170
+ end
171
+ end
172
+ end
173
+ context "when transport_mode is nil" do
174
+ it "should be nil" do
175
+ subject.transport_mode = nil
176
+ expect(subject.transport_mode_name).to be_nil
177
+ end
178
+ end
179
+
180
+ end
181
+
182
+ describe "#transport_mode_name=" do
183
+
184
+ it "should change transport_mode with TransportMode#name" do
185
+ subject.transport_mode_name = "Test"
186
+ expect(subject.transport_mode).to eq("Test")
187
+ end
188
+
189
+ end
190
+
191
+ describe ".transport_mode_names" do
192
+
193
+ it "should not include unknown transport_mode_name" do
194
+ expect(Chouette::VehicleJourney.transport_mode_names).not_to include(Chouette::TransportMode.new("unknown"))
195
+ end
196
+
197
+ it "should not include interchange transport_mode" do
198
+ expect(Chouette::VehicleJourney.transport_mode_names).not_to include(Chouette::TransportMode.new("interchange"))
199
+ end
200
+
201
+ end
202
+
203
+ describe "#footnote_ids=" do
204
+ context "when line have footnotes, " do
205
+ let!( :route) { create( :route ) }
206
+ let!( :line) { route.line }
207
+ let!( :footnote_first) {create( :footnote, :code => "1", :label => "dummy 1", :line => route.line)}
208
+ let!( :footnote_second) {create( :footnote, :code => "2", :label => "dummy 2", :line => route.line)}
209
+
210
+
211
+ it "should update vehicle's footnotes" do
212
+ expect(Chouette::VehicleJourney.find(subject.id).footnotes).to be_empty
213
+ subject.footnote_ids = [ footnote_first.id ]
214
+ subject.save
215
+ expect(Chouette::VehicleJourney.find(subject.id).footnotes.count).to eq(1)
216
+ end
217
+
218
+ end
219
+
220
+ end
221
+
222
+ end
223
+