aboutsummaryrefslogtreecommitdiffstats
path: root/spec/views
AgeCommit message (Collapse)Author
2018-01-17offer_workbenches/show.html.erb_spec: Give workbenches same workgroup5592-workbenches-show--filter-by-workgroup-on-initial-loadTeddy Wing
I was getting the following test failures after having modified `Workbench#all_referentials` in 93b60066cc49d699171d6a50798c5939a4644eea: Failures: 1) workbenches/show should include #<Referential id: 5, name: "Test 4", slug: "test_4", created_at: "2018-01-17 10:18:47", updated_at: "...from_id: nil, ready: true, referential_suite_id: nil, objectid_format: "stif_netex", merged_at: nil> Failure/Error: expect(workbench.all_referentials).to include different_organisation_referential expected #<ActiveRecord::AssociationRelation [#<Referential id: 3, name: "Test 2", slug: "test_2", created_at:...om_id: nil, ready: true, referential_suite_id: nil, objectid_format: "stif_netex", merged_at: nil>]> to include #<Referential id: 5, name: "Test 4", slug: "test_4", created_at: "2018-01-17 10:18:47", updated_at: "...from_id: nil, ready: true, referential_suite_id: nil, objectid_format: "stif_netex", merged_at: nil> Diff: @@ -1,2 +1,25 @@ -[#<Referential id: 5, name: "Test 4", slug: "test_4", created_at: "2018-01-17 10:18:47", updated_at: "2018-01-17 10:18:49", prefix: "organisation_5", projection_type: nil, time_zone: "Europe/Paris", bounds: nil, organisation_id: 6, geographical_bounds: nil, user_id: nil, user_name: nil, data_format: "netex", line_referential_id: 14, stop_area_referential_id: 10, workbench_id: 3, archived_at: nil, created_from_id: nil, ready: true, referential_suite_id: nil, objectid_format: "stif_netex", merged_at: nil>] +[#<Referential:0x007fd30e897428 + id: 3, + name: "Test 2", + slug: "test_2", + created_at: Wed, 17 Jan 2018 11:18:42 CET +01:00, + updated_at: Wed, 17 Jan 2018 11:18:44 CET +01:00, + prefix: "organisation_3", + projection_type: nil, + time_zone: "Europe/Paris", + bounds: nil, + organisation_id: 4, + geographical_bounds: nil, + user_id: nil, + user_name: nil, + data_format: "netex", + line_referential_id: 4, + stop_area_referential_id: 4, + workbench_id: 2, + archived_at: nil, + created_from_id: nil, + ready: true, + referential_suite_id: nil, + objectid_format: "stif_netex", + merged_at: nil>] # ./spec/views/offer_workbenches/show.html.erb_spec.rb:37:in `block (2 levels) in <top (required)>' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `block in load' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load' # .../.gem/ruby/2.3.3/gems/spring-commands-rspec-1.0.4/lib/spring/commands/rspec.rb:18:in `call' # -e:1:in `<main>' 2) workbenches/show without permission should disable all the checkboxes Failure/Error: expect(workbench.all_referentials).to include different_organisation_referential expected #<ActiveRecord::AssociationRelation [#<Referential id: 7, name: "Test 6", slug: "test_6", created_at:...om_id: nil, ready: true, referential_suite_id: nil, objectid_format: "stif_netex", merged_at: nil>]> to include #<Referential id: 9, name: "Test 8", slug: "test_8", created_at: "2018-01-17 10:18:55", updated_at: "...from_id: nil, ready: true, referential_suite_id: nil, objectid_format: "stif_netex", merged_at: nil> Diff: @@ -1,2 +1,25 @@ -[#<Referential id: 9, name: "Test 8", slug: "test_8", created_at: "2018-01-17 10:18:55", updated_at: "2018-01-17 10:18:57", prefix: "organisation_11", projection_type: nil, time_zone: "Europe/Paris", bounds: nil, organisation_id: 12, geographical_bounds: nil, user_id: nil, user_name: nil, data_format: "netex", line_referential_id: 26, stop_area_referential_id: 18, workbench_id: 5, archived_at: nil, created_from_id: nil, ready: true, referential_suite_id: nil, objectid_format: "stif_netex", merged_at: nil>] +[#<Referential:0x007fd30eadc210 + id: 7, + name: "Test 6", + slug: "test_6", + created_at: Wed, 17 Jan 2018 11:18:52 CET +01:00, + updated_at: Wed, 17 Jan 2018 11:18:53 CET +01:00, + prefix: "organisation_9", + projection_type: nil, + time_zone: "Europe/Paris", + bounds: nil, + organisation_id: 10, + geographical_bounds: nil, + user_id: nil, + user_name: nil, + data_format: "netex", + line_referential_id: 16, + stop_area_referential_id: 12, + workbench_id: 4, + archived_at: nil, + created_from_id: nil, + ready: true, + referential_suite_id: nil, + objectid_format: "stif_netex", + merged_at: nil>] # ./spec/views/offer_workbenches/show.html.erb_spec.rb:37:in `block (2 levels) in <top (required)>' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `block in load' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load' # .../.gem/ruby/2.3.3/gems/spring-commands-rspec-1.0.4/lib/spring/commands/rspec.rb:18:in `call' # -e:1:in `<main>' 3) workbenches/show with permission referentials.destroy should enable the checkbox for the referential which belongs to the same organisation and disable the other one Failure/Error: expect(workbench.all_referentials).to include different_organisation_referential expected #<ActiveRecord::AssociationRelation [#<Referential id: 11, name: "Test 10", slug: "test_10", created_...om_id: nil, ready: true, referential_suite_id: nil, objectid_format: "stif_netex", merged_at: nil>]> to include #<Referential id: 13, name: "Test 12", slug: "test_12", created_at: "2018-01-17 10:19:03", updated_at...from_id: nil, ready: true, referential_suite_id: nil, objectid_format: "stif_netex", merged_at: nil> Diff: @@ -1,2 +1,25 @@ -[#<Referential id: 13, name: "Test 12", slug: "test_12", created_at: "2018-01-17 10:19:03", updated_at: "2018-01-17 10:19:05", prefix: "organisation_17", projection_type: nil, time_zone: "Europe/Paris", bounds: nil, organisation_id: 18, geographical_bounds: nil, user_id: nil, user_name: nil, data_format: "netex", line_referential_id: 38, stop_area_referential_id: 26, workbench_id: 7, archived_at: nil, created_from_id: nil, ready: true, referential_suite_id: nil, objectid_format: "stif_netex", merged_at: nil>] +[#<Referential:0x007fd309268e30 + id: 11, + name: "Test 10", + slug: "test_10", + created_at: Wed, 17 Jan 2018 11:19:00 CET +01:00, + updated_at: Wed, 17 Jan 2018 11:19:02 CET +01:00, + prefix: "organisation_15", + projection_type: nil, + time_zone: "Europe/Paris", + bounds: nil, + organisation_id: 16, + geographical_bounds: nil, + user_id: nil, + user_name: nil, + data_format: "netex", + line_referential_id: 28, + stop_area_referential_id: 20, + workbench_id: 6, + archived_at: nil, + created_from_id: nil, + ready: true, + referential_suite_id: nil, + objectid_format: "stif_netex", + merged_at: nil>] # ./spec/views/offer_workbenches/show.html.erb_spec.rb:37:in `block (2 levels) in <top (required)>' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `block in load' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load' # .../.gem/ruby/2.3.3/gems/spring-commands-rspec-1.0.4/lib/spring/commands/rspec.rb:18:in `call' # -e:1:in `<main>' Finished in 29.81 seconds (files took 1.7 seconds to load) 3 examples, 3 failures The new behaviour requires referentials to have the same workgroup in order to be displayed on this page. Modify the test to give both `same_organisation_referential` and `different_organisation_referential` the same workgroup to get the tests to pass. Refs #5592
2018-01-03Fix import messages style Refs #4473 @2Luc Donnet
2017-12-29Fixes selectors in imports#show specs. Refs #4473Alban Peignier
2017-12-29Replace CommonHelper.string_keys_to_symbols by Hash#symbolize_keysAlban Peignier
2017-12-21Refs #5349 @1h; Deactivate StopAreas instead of destroying them5349-deactivate-stop-areasZog
- Update decorators (had to split `action_links` because of `StopPointDecorator` inheriting from `StopAreaDecorator`) - Add methods on model - Add routes - Add actions on controller (`Activatable` concern, shared with `LinesController`) - Add I18n keys
2017-12-21Refs #5430 @2h; Deactivate lines instead of destroying themZog
- Add `activate` and `deactivate` actions in `LinesController`, as well as corresponding routes - Add `activate!` and `deactivate!` methods in `Chouette::Line`, as well as `activated?` - Add `activate?` and `deactivate?` permissions in `LinePolicy` - Add corresponding `action_links`in the Decorator - Create helper for these actions - Add an optional `'extra_class` to the Links - Update styles for ".delete-action" to handle the case where there are several - Add I18n keys accordingly
2017-12-21Change button type for opposite route link. Refs #53555355-add-button-to-opposite-itinerary-timetableAlban Peignier
2017-12-21Refs #5355 @0.5h; Add opposite route button on timetablesZog
2017-12-20Check stop_area_waiting_time feature to display StopArea#waiting_time. Refs ↵5351-stop-area-waiting-timeAlban Peignier
#5351
2017-12-20Remove binding.pry in specsAlban Peignier
2017-12-20Merge pull request #151 from ↵Luc Donnet
af83/5281-workbench-import-structural-bug-reading-zip 5281 workbench import structural bug reading zip
2017-12-20Merge branch 'master' into 5333-add-policies-for-referentials-sharing5333-add-policies-for-referentials-sharingAlban Peignier
2017-12-19Replace have_link_for_each_stop_area by have_link_for_each_item as espected. ↵Alban Peignier
Refs #5291 @5m
2017-12-19Ref #5291@2h; Specs setupZog
- Refactor specs helper to be more generic - Write missing specs for the Workbenches#show view We now have failing tests highlighting the bug
2017-12-19Refs #5291@0.5h; Update viewZog
Update the view to match the actual controller behaviour.
2017-12-19Refs: #5291@1h; Update TableBuilderHelperZog
Update TableBuilderHelper to allow the `selectable` param to be a lambda, thus allowing us to have row-based granularity.
2017-12-19Ref #5291@2h; Specs setupZog
- Refactor specs helper to be more generic - Write missing specs for the Workbenches#show view We now have failing tests highlighting the bug
2017-12-19Refs #5287; Uniformize actions5287-clean-links-in-stop-areas-indexZog
2017-12-19Refs #5287; CR 1Zog
- Get rid of ActiveSupport::Concern in the spec helpers - Rename misnamed spec files
2017-12-19Refactor stopareas index specsZog
2017-12-19- Fix specs on connections_links/indexZog
- Fix specs on connections_links/show - Update pundit view specs helper to use the current referential when it has already been defined
2017-12-19Refs #5287;Zog
Add specs for the view. Refactor to come
2017-12-19Refs #5333@1.5h; Use permissions to sync StopAreas and LinesZog
- add missing policies - update permissions translator - update views to check for the permission - update views helper to check for the permission - uipdate controllers to check for the permission
2017-12-19Refs #5291@0.5h; Update viewZog
Update the view to match the actual controller behaviour.
2017-12-19Refs: #5291@1h; Update TableBuilderHelperZog
Update TableBuilderHelper to allow the `selectable` param to be a lambda, thus allowing us to have row-based granularity.
2017-12-19Ref #5291@2h; Specs setupZog
- Refactor specs helper to be more generic - Write missing specs for the Workbenches#show view We now have failing tests highlighting the bug
2017-12-19Merge branch '5287-clean-links-in-stop-areas-index'Zog
2017-12-18Refs #5287; CR 1Zog
- Get rid of ActiveSupport::Concern in the spec helpers - Rename misnamed spec files
2017-12-15Refactor stopareas index specsZog
2017-12-15- Fix specs on connections_links/indexZog
- Fix specs on connections_links/show - Update pundit view specs helper to use the current referential when it has already been defined
2017-12-15Refs #5287;Zog
Add specs for the view. Refactor to come
2017-12-15Fixes: #5281@1.2h; View specs and minor CR change from #50065281-workbench-import-structural-bug-reading-zipRobert
- CR change from #5006, severity of zip file messages :warning -> :error - View specs for showing import_messages
2017-11-28Remove page title test on views specXinhui
2017-11-28Refactoring move render pageheader into layoutXinhui
2017-11-14Remove rule parameter set controller, views, helperXinhui
Refs #4516
2017-10-02Fix specs for new tranport mode listcedricnjanga
2017-07-12stop_areas/show.html.erb_spec.rb: Decorate stop areaTeddy Wing
In order to get the `#action_links` method to be found by the new table builder, decorate the stop area. Refs #3479
2017-07-12routes/show.html.erb_spec.rb: Update for new table builder helperTeddy Wing
Need to decorate the stop points collection in order to be able to call `#action_links` on the objects therein. Added a stub for `pundit_user` to get around `TableBuilderHelper#table_builder_2` having a dependency on `ApplicationController#pundit_user`. Don't like this stub at all. Should be doing this in a better way. Refs #3479
2017-07-12networks/show.html.erb_spec.rb: Decorate test networkTeddy Wing
In order to get the view to render correctly and not fail on the `network.action_links` call, decorate the network used in these tests. Refs #3479
2017-07-11coherent spec file; no require (as in .rspec) and explicit RSpec.describeRobert
2017-07-11Refs #2646: fix route view testjpl
2017-06-19time_tables/show.html.erb_spec.rb: Fix specs from `TimeTableDecorator`Teddy Wing
Was getting these failures after switching the controller over to use a decorated `@time_table`: Failures: 1) /time_tables/show should render h2 with the time_table comment Failure/Error: - @time_table.action_links.each do |link| ActionView::Template::Error: undefined method `action_links' for #<Chouette::TimeTable:0x007fc8cefb8260> # ./app/views/time_tables/show.html.slim:13:in `block in _app_views_time_tables_show_html_slim__2702796193816469913_70250218141540' # ./app/helpers/newapplication_helper.rb:246:in `block (2 levels) in pageheader' # ./app/helpers/newapplication_helper.rb:244:in `block in pageheader' # ./app/helpers/newapplication_helper.rb:243:in `pageheader' # ./app/views/time_tables/show.html.slim:4:in `_app_views_time_tables_show_html_slim__2702796193816469913_70250218141540' # ./spec/views/time_tables/show.html.erb_spec.rb:15:in `block (2 levels) in <top (required)>' # -e:1:in `<main>' # ------------------ # --- Caused by: --- # NoMethodError: # undefined method `action_links' for #<Chouette::TimeTable:0x007fc8cefb8260> # ./app/views/time_tables/show.html.slim:13:in `block in _app_views_time_tables_show_html_slim__2702796193816469913_70250218141540' 2) /time_tables/show should render a link to edit the time_table Failure/Error: - @time_table.action_links.each do |link| ActionView::Template::Error: undefined method `action_links' for #<Chouette::TimeTable:0x007fc8cb65b148> # ./app/views/time_tables/show.html.slim:13:in `block in _app_views_time_tables_show_html_slim__2702796193816469913_70250218141540' # ./app/helpers/newapplication_helper.rb:246:in `block (2 levels) in pageheader' # ./app/helpers/newapplication_helper.rb:244:in `block in pageheader' # ./app/helpers/newapplication_helper.rb:243:in `pageheader' # ./app/views/time_tables/show.html.slim:4:in `_app_views_time_tables_show_html_slim__2702796193816469913_70250218141540' # ./spec/views/time_tables/show.html.erb_spec.rb:20:in `block (2 levels) in <top (required)>' # -e:1:in `<main>' # ------------------ # --- Caused by: --- # NoMethodError: # undefined method `action_links' for #<Chouette::TimeTable:0x007fc8cb65b148> # ./app/views/time_tables/show.html.slim:13:in `block in _app_views_time_tables_show_html_slim__2702796193816469913_70250218141540' 3) /time_tables/show should render a link to remove the time_table Failure/Error: - @time_table.action_links.each do |link| ActionView::Template::Error: undefined method `action_links' for #<Chouette::TimeTable:0x007fc8cd251820> # ./app/views/time_tables/show.html.slim:13:in `block in _app_views_time_tables_show_html_slim__2702796193816469913_70250218141540' # ./app/helpers/newapplication_helper.rb:246:in `block (2 levels) in pageheader' # ./app/helpers/newapplication_helper.rb:244:in `block in pageheader' # ./app/helpers/newapplication_helper.rb:243:in `pageheader' # ./app/views/time_tables/show.html.slim:4:in `_app_views_time_tables_show_html_slim__2702796193816469913_70250218141540' # ./spec/views/time_tables/show.html.erb_spec.rb:25:in `block (2 levels) in <top (required)>' # -e:1:in `<main>' # ------------------ # --- Caused by: --- # NoMethodError: # undefined method `action_links' for #<Chouette::TimeTable:0x007fc8cd251820> # ./app/views/time_tables/show.html.slim:13:in `block in _app_views_time_tables_show_html_slim__2702796193816469913_70250218141540' Finished in 2.44 seconds (files took 0.82818 seconds to load) 3 examples, 3 failures Failed examples: rspec ./spec/views/time_tables/show.html.erb_spec.rb:14 # /time_tables/show should render h2 with the time_table comment rspec ./spec/views/time_tables/show.html.erb_spec.rb:19 # /time_tables/show should render a link to edit the time_table rspec ./spec/views/time_tables/show.html.erb_spec.rb:24 # /time_tables/show should render a link to remove the time_table To match the controller, we need to decorate the `time_table` objects used in these tests as well, because the view code has changed. Decoration is necessary to give us the `#action_links` method that we use to render the header links on the page. Refs #3479
2017-06-19lines/show.html.erb_spec.rb: Fix specs resulting from `LineDecorator`Teddy Wing
The tests failed because we weren't using a decorated `Chouette::Line` object, but the views now expect decorated lines in order to be able to call the `#action_links` method. Here are our failures: 5) /lines/show should render h1 with the line name Failure/Error: - @line.action_links.each do |link| ActionView::Template::Error: undefined method `action_links' for #<Chouette::Line:0x007fc8cdf0bb88> # ./app/views/lines/show.html.slim:10:in `block in _app_views_lines_show_html_slim___3813514632397395671_70250211127360' # ./app/helpers/newapplication_helper.rb:246:in `block (2 levels) in pageheader' # ./app/helpers/newapplication_helper.rb:244:in `block in pageheader' # ./app/helpers/newapplication_helper.rb:243:in `pageheader' # ./app/views/lines/show.html.slim:2:in `_app_views_lines_show_html_slim___3813514632397395671_70250211127360' # ./spec/views/lines/show.html.erb_spec.rb:16:in `block (2 levels) in <top (required)>' # -e:1:in `<main>' # ------------------ # --- Caused by: --- # NoMethodError: # undefined method `action_links' for #<Chouette::Line:0x007fc8cdf0bb88> # ./app/views/lines/show.html.slim:10:in `block in _app_views_lines_show_html_slim___3813514632397395671_70250211127360' 6) /lines/show should render a link to remove the line Failure/Error: - @line.action_links.each do |link| ActionView::Template::Error: undefined method `action_links' for #<Chouette::Line:0x007fc8cfdaa710> # ./app/views/lines/show.html.slim:10:in `block in _app_views_lines_show_html_slim___3813514632397395671_70250211127360' # ./app/helpers/newapplication_helper.rb:246:in `block (2 levels) in pageheader' # ./app/helpers/newapplication_helper.rb:244:in `block in pageheader' # ./app/helpers/newapplication_helper.rb:243:in `pageheader' # ./app/views/lines/show.html.slim:2:in `_app_views_lines_show_html_slim___3813514632397395671_70250211127360' # ./spec/views/lines/show.html.erb_spec.rb:31:in `block (2 levels) in <top (required)>' # -e:1:in `<main>' # ------------------ # --- Caused by: --- # NoMethodError: # undefined method `action_links' for #<Chouette::Line:0x007fc8cfdaa710> # ./app/views/lines/show.html.slim:10:in `block in _app_views_lines_show_html_slim___3813514632397395671_70250211127360' Update the test to decorate the lines used in them. Turn `current_organisation` into a `context` field on `LineDecorator` because otherwise it's a global variable that comes from wherever that's required in `LineDecorator`. And we'd have to mock `current_organisation` on `line` in the test, which I wasn't keen on. Refs #3479
2017-06-16Add auto assign of slug and prefix for referential#createXinhui
Refs #3657
2017-04-25Refs #3183 #3185: starting init for create/duplicate, adding actionType to ↵jpl
state (fix tests)
2017-04-24Refs #2893: remove (again) rails form in tt#edit (managed by reactux)jpl
2017-04-11Deprecation Warnings removed; Seeds corrected, Refs: #2070RobertDober
2017-04-10Refs #2909: Fix tests, updating table builderjpl
2017-04-06Refs #2890: updating time_tables#show (calendars helper refacto in progress)jpl
2017-04-04Refs #2892: starting integration update on timetables#editjpl