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
File without changes
File without changes
File without changes
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
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
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/404.html -->
52
+ <div class="dialog">
53
+ <h1>The page you were looking for doesn't exist.</h1>
54
+ <p>You may have mistyped the address or the page may have moved.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
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
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/422.html -->
52
+ <div class="dialog">
53
+ <h1>The change you wanted was rejected.</h1>
54
+ <p>Maybe you tried to change something you didn't have access to.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
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
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/500.html -->
52
+ <div class="dialog">
53
+ <h1>We're sorry, but something went wrong.</h1>
54
+ </div>
55
+ <p>If you are the application owner check the logs for more information.</p>
56
+ </body>
57
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env jruby
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'
@@ -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