diff options
| author | Teddy Wing | 2017-06-19 18:35:26 +0200 |
|---|---|---|
| committer | Teddy Wing | 2017-06-19 18:40:09 +0200 |
| commit | 140270297b1db064b78472ccd7e59b8279d21be7 (patch) | |
| tree | 05f88105db533f19691a6de04adcd1a9d15d4f20 /spec/javascripts | |
| parent | b281113868ee80edb61de5b03adb761e4ceca036 (diff) | |
| download | chouette-core-140270297b1db064b78472ccd7e59b8279d21be7.tar.bz2 | |
lines/show.html.erb_spec.rb: Fix specs resulting from `LineDecorator`
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
Diffstat (limited to 'spec/javascripts')
0 files changed, 0 insertions, 0 deletions
