aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-06-19 18:43:16 +0200
committerTeddy Wing2017-06-19 18:43:16 +0200
commit3343920fe8df5378f7bced238b03860e249ac1cf (patch)
tree57195843d147f5b4f1472701ec6af477b7c97ae9
parent140270297b1db064b78472ccd7e59b8279d21be7 (diff)
downloadchouette-core-3343920fe8df5378f7bced238b03860e249ac1cf.tar.bz2
time_tables/show.html.erb_spec.rb: Fix specs from `TimeTableDecorator`
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
-rw-r--r--spec/views/time_tables/show.html.erb_spec.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/views/time_tables/show.html.erb_spec.rb b/spec/views/time_tables/show.html.erb_spec.rb
index f429f9dec..edfb3f3cc 100644
--- a/spec/views/time_tables/show.html.erb_spec.rb
+++ b/spec/views/time_tables/show.html.erb_spec.rb
@@ -3,7 +3,14 @@ require 'spec_helper'
describe "/time_tables/show", :type => :view do
assign_referential
- let!(:time_table) { assign(:time_table, create(:time_table)) }
+ let!(:time_table) do
+ assign(
+ :time_table,
+ create(:time_table).decorate(context: {
+ referential: referential
+ })
+ )
+ end
let!(:year) { assign(:year, Date.today.cwyear) }
let!(:time_table_combination) {assign(:time_table_combination, TimeTableCombination.new)}