ninoxe 1.1.5 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +9 -12
  3. data/app/models/chouette/access_link.rb +52 -51
  4. data/app/models/chouette/access_point.rb +7 -7
  5. data/app/models/chouette/active_record.rb +28 -28
  6. data/app/models/chouette/company.rb +3 -3
  7. data/app/models/chouette/connection_link.rb +3 -3
  8. data/app/models/chouette/footnote.rb +1 -1
  9. data/app/models/chouette/group_of_line.rb +2 -2
  10. data/app/models/chouette/journey_pattern.rb +7 -3
  11. data/app/models/chouette/line.rb +11 -9
  12. data/app/models/chouette/network.rb +2 -2
  13. data/app/models/chouette/pt_link.rb +1 -1
  14. data/app/models/chouette/route.rb +9 -10
  15. data/app/models/chouette/stop_area.rb +8 -8
  16. data/app/models/chouette/stop_point.rb +3 -3
  17. data/app/models/chouette/time_table.rb +25 -122
  18. data/app/models/chouette/time_table_date.rb +1 -1
  19. data/app/models/chouette/time_table_period.rb +1 -1
  20. data/app/models/chouette/vehicle_journey.rb +82 -77
  21. data/app/models/chouette/vehicle_journey_at_stop.rb +1 -1
  22. data/config/database.yml +16 -8
  23. data/config/database.yml.travis +15 -6
  24. data/db/migrate/20150526075108_add_foreign_key_to_routes.rb +28 -0
  25. data/lib/ninoxe/engine.rb +4 -0
  26. data/lib/ninoxe/version.rb +1 -1
  27. data/lib/ninoxe.rb +3 -0
  28. data/spec/dummy/README.rdoc +15 -248
  29. data/spec/dummy/Rakefile +1 -1
  30. data/spec/dummy/app/{mailers/.gitkeep → assets/images/.keep} +0 -0
  31. data/spec/dummy/app/assets/javascripts/application.js +3 -5
  32. data/spec/dummy/app/assets/stylesheets/application.css +1 -1
  33. data/spec/dummy/app/controllers/application_controller.rb +3 -1
  34. data/spec/dummy/app/{models/.gitkeep → controllers/concerns/.keep} +0 -0
  35. data/spec/dummy/{lib/assets/.gitkeep → app/mailers/.keep} +0 -0
  36. data/spec/dummy/{log/.gitkeep → app/models/.keep} +0 -0
  37. data/spec/dummy/app/models/concerns/.keep +0 -0
  38. data/spec/dummy/app/views/layouts/application.html.erb +2 -2
  39. data/spec/dummy/bin/bundle +3 -0
  40. data/spec/dummy/bin/rails +4 -0
  41. data/spec/dummy/bin/rake +4 -0
  42. data/spec/dummy/config/application.rb +8 -36
  43. data/spec/dummy/config/boot.rb +4 -9
  44. data/spec/dummy/config/database.yml +16 -8
  45. data/spec/dummy/config/environment.rb +2 -4
  46. data/spec/dummy/config/environments/development.rb +11 -19
  47. data/spec/dummy/config/environments/production.rb +41 -28
  48. data/spec/dummy/config/environments/test.rb +13 -14
  49. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  50. data/spec/dummy/config/initializers/inflections.rb +6 -5
  51. data/spec/dummy/config/initializers/secret_token.rb +7 -2
  52. data/spec/dummy/config/initializers/session_store.rb +1 -6
  53. data/spec/dummy/config/initializers/wrap_parameters.rb +6 -6
  54. data/spec/dummy/config/locales/en.yml +20 -2
  55. data/spec/dummy/config/locales/fr.yml +23 -0
  56. data/spec/dummy/config.ru +1 -1
  57. data/spec/dummy/db/schema.rb +147 -143
  58. data/spec/dummy/lib/assets/.keep +0 -0
  59. data/spec/dummy/log/.keep +0 -0
  60. data/spec/dummy/public/404.html +43 -11
  61. data/spec/dummy/public/422.html +43 -11
  62. data/spec/dummy/public/500.html +43 -11
  63. data/spec/dummy/script/rails +1 -1
  64. data/spec/factories/chouette_access_links.rb +13 -0
  65. data/spec/factories/chouette_access_points.rb +12 -0
  66. data/spec/factories/chouette_companies.rb +9 -0
  67. data/spec/factories/chouette_connection_links.rb +13 -0
  68. data/spec/factories/chouette_footnotes.rb +10 -0
  69. data/spec/factories/chouette_group_of_lines.rb +9 -0
  70. data/spec/factories/chouette_journey_pattern.rb +40 -0
  71. data/spec/factories/chouette_lines.rb +44 -0
  72. data/spec/factories/chouette_networks.rb +9 -0
  73. data/spec/factories/chouette_routes.rb +26 -0
  74. data/spec/factories/chouette_stop_areas.rb +12 -0
  75. data/spec/factories/chouette_stop_points.rb +10 -0
  76. data/spec/factories/chouette_time_table.rb +37 -0
  77. data/spec/factories/chouette_vehicle_journey.rb +66 -0
  78. data/spec/factories/chouette_vehicle_journey_at_stop.rb +8 -0
  79. data/spec/models/chouette/access_link_spec.rb +17 -13
  80. data/spec/models/chouette/access_point_spec.rb +106 -103
  81. data/spec/models/chouette/active_record_spec.rb +57 -57
  82. data/spec/models/chouette/area_type_spec.rb +8 -8
  83. data/spec/models/chouette/company_spec.rb +18 -18
  84. data/spec/models/chouette/connection_link_spec.rb +19 -15
  85. data/spec/models/chouette/direction_spec.rb +8 -8
  86. data/spec/models/chouette/exporter_spec.rb +4 -4
  87. data/spec/models/chouette/file_validator_spec.rb +4 -4
  88. data/spec/models/chouette/footnote_spec.rb +1 -1
  89. data/spec/models/chouette/group_of_line_spec.rb +11 -11
  90. data/spec/models/chouette/journey_pattern_spec.rb +16 -14
  91. data/spec/models/chouette/line_spec.rb +36 -32
  92. data/spec/models/chouette/loader_spec.rb +9 -9
  93. data/spec/models/chouette/network_spec.rb +9 -9
  94. data/spec/models/chouette/object_id_spec.rb +31 -28
  95. data/spec/models/chouette/route_spec.rb +51 -47
  96. data/spec/models/chouette/stop_area_spec.rb +191 -188
  97. data/spec/models/chouette/stop_point_spec.rb +13 -10
  98. data/spec/models/chouette/time_table_period_spec.rb +18 -18
  99. data/spec/models/chouette/time_table_spec.rb +303 -255
  100. data/spec/models/chouette/transport_mode_spec.rb +10 -10
  101. data/spec/models/chouette/trident_active_record_spec.rb +17 -17
  102. data/spec/models/chouette/vehicle_journey_at_stop_spec.rb +13 -12
  103. data/spec/models/chouette/vehicle_journey_spec.rb +46 -46
  104. data/spec/presenters/chouette/geometry/line_presenter_spec.rb +2 -2
  105. data/spec/spec_helper.rb +22 -9
  106. metadata +102 -87
  107. data/config/database.yml.ci +0 -14
  108. data/lib/factories/chouette_access_links.rb +0 -11
  109. data/lib/factories/chouette_access_points.rb +0 -8
  110. data/lib/factories/chouette_companies.rb +0 -5
  111. data/lib/factories/chouette_connection_links.rb +0 -11
  112. data/lib/factories/chouette_footnotes.rb +0 -6
  113. data/lib/factories/chouette_group_of_lines.rb +0 -5
  114. data/lib/factories/chouette_journey_pattern.rb +0 -32
  115. data/lib/factories/chouette_lines.rb +0 -31
  116. data/lib/factories/chouette_networks.rb +0 -5
  117. data/lib/factories/chouette_routes.rb +0 -20
  118. data/lib/factories/chouette_stop_areas.rb +0 -8
  119. data/lib/factories/chouette_stop_points.rb +0 -7
  120. data/lib/factories/chouette_time_table.rb +0 -23
  121. data/lib/factories/chouette_vehicle_journey.rb +0 -51
  122. data/lib/factories/chouette_vehicle_journey_at_stop.rb +0 -5
  123. data/spec/dummy/config/initializers/active_record.rb +0 -2
@@ -2,17 +2,48 @@
2
2
  <html>
3
3
  <head>
4
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; }
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
16
47
  </style>
17
48
  </head>
18
49
 
@@ -22,5 +53,6 @@
22
53
  <h1>The change you wanted was rejected.</h1>
23
54
  <p>Maybe you tried to change something you didn't have access to.</p>
24
55
  </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
25
57
  </body>
26
58
  </html>
@@ -2,17 +2,48 @@
2
2
  <html>
3
3
  <head>
4
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; }
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
16
47
  </style>
17
48
  </head>
18
49
 
@@ -21,5 +52,6 @@
21
52
  <div class="dialog">
22
53
  <h1>We're sorry, but something went wrong.</h1>
23
54
  </div>
55
+ <p>If you are the application owner check the logs for more information.</p>
24
56
  </body>
25
57
  </html>
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env ruby1.8
1
+ #!/usr/bin/env jruby
2
2
  # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
3
 
4
4
  APP_PATH = File.expand_path('../../config/application', __FILE__)
@@ -0,0 +1,13 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :access_link, :class => Chouette::AccessLink do
4
+ sequence(:name) { |n| "Access link #{n}" }
5
+ sequence(:objectid) { |n| "test:AccessLink:#{n}" }
6
+ link_type "Mixed"
7
+ link_orientation "AccessPointToStopArea"
8
+
9
+ association :stop_area, :factory => :stop_area
10
+ association :access_point, :factory => :access_point
11
+ end
12
+
13
+ end
@@ -0,0 +1,12 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :access_point, :class => Chouette::AccessPoint do
4
+ latitude {10.0 * rand}
5
+ longitude {10.0 * rand}
6
+ sequence(:name) { |n| "AccessPoint #{n}" }
7
+ access_type "InOut"
8
+ sequence(:objectid) { |n| "test:AccessPoint:#{n}" }
9
+ association :stop_area, :factory => :stop_area
10
+ end
11
+
12
+ end
@@ -0,0 +1,9 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :company, :class => Chouette::Company do
4
+ sequence(:name) { |n| "Company #{n}" }
5
+ sequence(:objectid) { |n| "test:Company:#{n}" }
6
+ sequence(:registration_number) { |n| "test-#{n}" }
7
+ end
8
+
9
+ end
@@ -0,0 +1,13 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :connection_link, :class => Chouette::ConnectionLink do
4
+ sequence(:name) { |n| "Connection link #{n}" }
5
+ sequence(:link_type) { |n| "Mixed" }
6
+ sequence(:objectid) { |n| "test:ConnectionLink:#{n}" }
7
+
8
+ association :departure, :factory => :stop_area
9
+ association :arrival, :factory => :stop_area
10
+ end
11
+
12
+ end
13
+
@@ -0,0 +1,10 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :footnote, :class => Chouette::Footnote do
4
+ sequence(:code) { |n| "#{n}" }
5
+ sequence(:label) { |n| "footnote #{n}" }
6
+ association :line, :factory => :line
7
+ end
8
+
9
+ end
10
+
@@ -0,0 +1,9 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :group_of_line, :class => Chouette::GroupOfLine do
4
+ sequence(:name) { |n| "Group Of Line #{n}" }
5
+ sequence(:objectid) { |n| "test:GroupOfLine:#{n}" }
6
+ sequence(:registration_number) { |n| "#{n}" }
7
+ end
8
+
9
+ end
@@ -0,0 +1,40 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :journey_pattern_common, :class => Chouette::JourneyPattern do
4
+ sequence(:name) { |n| "jp name #{n}" }
5
+ sequence(:published_name) { |n| "jp publishedname #{n}" }
6
+ sequence(:comment) { |n| "jp comment #{n}" }
7
+ sequence(:registration_number) { |n| "jp registration_number #{n}" }
8
+ sequence(:objectid) { |n| "test:JourneyPattern:#{n}" }
9
+
10
+ association :route, :factory => :route
11
+
12
+ factory :journey_pattern do
13
+ after(:create) do |j|
14
+ j.stop_point_ids = j.route.stop_points.map(&:id)
15
+ j.departure_stop_point_id = j.route.stop_points.first.id
16
+ j.arrival_stop_point_id = j.route.stop_points.last.id
17
+ end
18
+ end
19
+
20
+ factory :journey_pattern_odd do
21
+ after(:create) do |j|
22
+ j.stop_point_ids = j.route.stop_points.select { |sp| sp.position%2==0}.map(&:id)
23
+ j.departure_stop_point_id = j.stop_point_ids.first
24
+ j.arrival_stop_point_id = j.stop_point_ids.last
25
+ end
26
+ end
27
+
28
+ factory :journey_pattern_even do
29
+ after(:create) do |j|
30
+ j.stop_point_ids = j.route.stop_points.select { |sp| sp.position%2==1}.map(&:id)
31
+ j.departure_stop_point_id = j.stop_point_ids.first
32
+ j.arrival_stop_point_id = j.stop_point_ids.last
33
+ end
34
+ end
35
+
36
+ end
37
+
38
+ end
39
+
40
+
@@ -0,0 +1,44 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :line, :class => Chouette::Line do
4
+ sequence(:name) { |n| "Line #{n}" }
5
+ sequence(:objectid) { |n| "test:Line:#{n}" }
6
+ sequence(:transport_mode_name) { |n| "Bus" }
7
+
8
+ association :network, :factory => :network
9
+ association :company, :factory => :company
10
+
11
+ sequence(:registration_number) { |n| "test-#{n}" }
12
+
13
+ factory :line_with_stop_areas do
14
+
15
+ transient do
16
+ routes_count 2
17
+ stop_areas_count 5
18
+ end
19
+
20
+ after(:create) do |line, evaluator|
21
+ create_list(:route, evaluator.routes_count, :line => line) do |route|
22
+ create_list(:stop_area, evaluator.stop_areas_count, area_type: "Quay") do |stop_area|
23
+ create(:stop_point, :stop_area => stop_area, :route => route)
24
+ end
25
+ end
26
+ end
27
+
28
+ factory :line_with_stop_areas_having_parent do
29
+
30
+ after(:create) do |line|
31
+ line.routes.each do |route|
32
+ route.stop_points.each do |stop_point|
33
+ comm = create(:stop_area, :area_type => "CommercialStopPoint")
34
+ stop_point.stop_area.update_attributes(:parent_id => comm.id)
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ end
41
+
42
+ end
43
+
44
+ end
@@ -0,0 +1,9 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :network, :class => Chouette::Network do
4
+ sequence(:name) { |n| "Network #{n}" }
5
+ sequence(:objectid) { |n| "test:GroupOfLine:#{n}" }
6
+ sequence(:registration_number) { |n| "test-#{n}" }
7
+ end
8
+
9
+ end
@@ -0,0 +1,26 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :route_common, :class => Chouette::Route do
4
+ sequence(:name) { |n| "Route #{n}" }
5
+ sequence(:published_name) { |n| "Long route #{n}" }
6
+ sequence(:number) { |n| "#{n}" }
7
+ sequence(:wayback_code) { |n| Chouette::Wayback.new( n % 2) }
8
+ sequence(:direction_code) { |n| Chouette::Direction.new( n % 12) }
9
+ sequence(:objectid) { |n| "test:Route:#{n}" }
10
+
11
+ association :line, :factory => :line
12
+
13
+ factory :route do
14
+
15
+ transient do
16
+ stop_points_count 5
17
+ end
18
+
19
+ after(:create) do |route, evaluator|
20
+ create_list(:stop_point, evaluator.stop_points_count, route: route)
21
+ end
22
+
23
+ end
24
+ end
25
+
26
+ end
@@ -0,0 +1,12 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :stop_area, :class => Chouette::StopArea do
4
+ sequence(:objectid) { |n| "test:StopArea:#{n}" }
5
+ sequence(:name) { |n| "stop_area_#{n}" }
6
+ sequence(:registration_number) { |n| "test-#{n}" }
7
+ area_type "CommercialStopPoint"
8
+ latitude {10.0 * rand}
9
+ longitude {10.0 * rand}
10
+ end
11
+
12
+ end
@@ -0,0 +1,10 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :stop_point, :class => Chouette::StopPoint do
4
+ sequence(:objectid) { |n| "test:StopPoint:#{n}" }
5
+ association :route, :factory => :route
6
+ association :stop_area, :factory => :stop_area
7
+ end
8
+
9
+ end
10
+
@@ -0,0 +1,37 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :time_table_date, :class => Chouette::TimeTableDate do
4
+ end
5
+
6
+ factory :time_table_period, :class => Chouette::TimeTablePeriod do
7
+ end
8
+
9
+ factory :time_table, :class => Chouette::TimeTable do
10
+ sequence(:comment) { |n| "Timetable #{n}" }
11
+ sequence(:objectid) { |n| "test:Timetable:#{n}" }
12
+ sequence(:int_day_types) { (1..7).to_a.map{ |n| 2**(n+1)}.sum }
13
+
14
+ transient do
15
+ dates_count 4
16
+ periods_count 4
17
+ end
18
+
19
+ after(:create) do |time_table, evaluator|
20
+
21
+ 0.upto(4) do |i|
22
+ time_table.dates << create(:time_table_date, :time_table => time_table, :date => i.days.since.to_date, :in_out => true)
23
+ end
24
+
25
+ start_date = Date.today
26
+ end_date = start_date + 10
27
+
28
+ 0.upto(4) do |i|
29
+ time_table.periods << create(:time_table_period, :time_table => time_table, :period_start => start_date, :period_end => end_date)
30
+ start_date = start_date + 20
31
+ end_date = start_date + 10
32
+ end
33
+ time_table.save_shortcuts
34
+ end
35
+ end
36
+
37
+ end
@@ -0,0 +1,66 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :vehicle_journey_common, :class => Chouette::VehicleJourney do
4
+ sequence(:objectid) { |n| "test:VehicleJourney:#{n}" }
5
+
6
+ factory :vehicle_journey do
7
+ association :journey_pattern, :factory => :journey_pattern
8
+
9
+ after(:build) do |vehicle_journey|
10
+ vehicle_journey.route = vehicle_journey.journey_pattern.route
11
+ end
12
+
13
+ after(:create) do |vehicle_journey|
14
+ vehicle_journey.journey_pattern.stop_points.each_with_index do |stop_point, index|
15
+ vehicle_journey.vehicle_journey_at_stops << create(:vehicle_journey_at_stop,
16
+ :vehicle_journey => vehicle_journey,
17
+ :stop_point => stop_point,
18
+ :arrival_time => (-1 * index).minutes.ago,
19
+ :departure_time => (-1 * index).minutes.ago)
20
+ end
21
+ end
22
+
23
+ factory :vehicle_journey_odd do
24
+ association :journey_pattern, :factory => :journey_pattern_odd
25
+ end
26
+
27
+ factory :vehicle_journey_even do
28
+ association :journey_pattern, :factory => :journey_pattern_even
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ # after(:build) do |vehicle_journey|
35
+ # vehicle_journey.route_id = vehicle_journey.journey_pattern.route_id
36
+ # end
37
+ #
38
+ # after(:create) do |vehicle_journey|
39
+ # vehicle_journey.journey_pattern.stop_points.each_with_index do |stop_point, index|
40
+ # vehicle_journey.vehicle_journey_at_stops.create(:vehicle_journey_at_stop,
41
+ # :vehicle_journey => vehicle_journey,
42
+ # :stop_point => stop_point,
43
+ # :arrival_time => (-1 * index).minutes.ago,
44
+ # :departure_time => (-1 * index).minutes.ago)
45
+ # end
46
+ # end
47
+ # end
48
+ #
49
+ # after(:build) do |vehicle_journey|
50
+ # vehicle_journey.route_id = vehicle_journey.journey_pattern.route_id
51
+ # end
52
+ #
53
+ # after(:create) do |vehicle_journey|
54
+ # vehicle_journey.journey_pattern.stop_points.each_with_index do |stop_point, index|
55
+ # vehicle_journey.vehicle_journey_at_stops.create(:vehicle_journey_at_stop,
56
+ # :vehicle_journey => vehicle_journey,
57
+ # :stop_point => stop_point,
58
+ # :arrival_time => (-1 * index).minutes.ago,
59
+ # :departure_time => (-1 * index).minutes.ago)
60
+ # end
61
+ # end
62
+ # end
63
+ #
64
+ # end
65
+ #end
66
+ #
@@ -0,0 +1,8 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :vehicle_journey_at_stop, :class => Chouette::VehicleJourneyAtStop do
4
+ association :vehicle_journey, :factory => :vehicle_journey
5
+ end
6
+
7
+ end
8
+
@@ -1,14 +1,18 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Chouette::AccessLink do
4
- subject { Factory(:access_link) }
3
+ describe Chouette::AccessLink, :type => :model do
4
+ subject { create(:access_link) }
5
5
 
6
- it { should validate_uniqueness_of :objectid }
7
- its(:objectid) { should be_kind_of(Chouette::ObjectId) }
6
+ it { is_expected.to validate_uniqueness_of :objectid }
8
7
 
9
- it { should validate_presence_of :name }
10
- it { should validate_presence_of :link_type }
11
- it { should validate_presence_of :link_orientation }
8
+ describe '#objectid' do
9
+ subject { super().objectid }
10
+ it { is_expected.to be_kind_of(Chouette::ObjectId) }
11
+ end
12
+
13
+ it { is_expected.to validate_presence_of :name }
14
+ it { is_expected.to validate_presence_of :link_type }
15
+ it { is_expected.to validate_presence_of :link_orientation }
12
16
 
13
17
  describe "#access_link_type" do
14
18
 
@@ -21,7 +25,7 @@ describe Chouette::AccessLink do
21
25
  access_link_type = Chouette::ConnectionLinkType.new(link_type.underscore)
22
26
  it "should be #{access_link_type}" do
23
27
  subject.link_type = link_type
24
- subject.access_link_type.should == access_link_type
28
+ expect(subject.access_link_type).to eq(access_link_type)
25
29
  end
26
30
  end
27
31
  end
@@ -31,7 +35,7 @@ describe Chouette::AccessLink do
31
35
 
32
36
  it "should change link_type with ConnectionLinkType#name" do
33
37
  subject.access_link_type = "underground"
34
- subject.link_type.should == "Underground"
38
+ expect(subject.link_type).to eq("Underground")
35
39
  end
36
40
 
37
41
  end
@@ -47,7 +51,7 @@ describe Chouette::AccessLink do
47
51
  link_orientation_type = Chouette::LinkOrientationType.new(link_orientation.underscore)
48
52
  it "should be #{link_orientation_type}" do
49
53
  subject.link_orientation = link_orientation
50
- subject.link_orientation_type.should == link_orientation_type
54
+ expect(subject.link_orientation_type).to eq(link_orientation_type)
51
55
  end
52
56
  end
53
57
  end
@@ -58,7 +62,7 @@ describe Chouette::AccessLink do
58
62
 
59
63
  it "should change link_orientation with LinkOrientationType#name" do
60
64
  subject.link_orientation_type = "access_point_to_stop_area"
61
- subject.link_orientation.should == "AccessPointToStopArea"
65
+ expect(subject.link_orientation).to eq("AccessPointToStopArea")
62
66
  end
63
67
 
64
68
  end
@@ -66,11 +70,11 @@ describe Chouette::AccessLink do
66
70
  describe "#link_key" do
67
71
  it "should calculate link_key for access to area" do
68
72
  subject.link_orientation_type = "access_point_to_stop_area"
69
- subject.link_key.should == "A_#{subject.access_point.id}-S_#{subject.stop_area.id}"
73
+ expect(subject.link_key).to eq("A_#{subject.access_point.id}-S_#{subject.stop_area.id}")
70
74
  end
71
75
  it "should calculate link_key for area to access" do
72
76
  subject.link_orientation_type = "stop_area_to_access_point"
73
- subject.link_key.should == "S_#{subject.stop_area.id}-A_#{subject.access_point.id}"
77
+ expect(subject.link_key).to eq("S_#{subject.stop_area.id}-A_#{subject.access_point.id}")
74
78
  end
75
79
 
76
80
  end