|
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
|