From dcede6f1d323c827ae9e663b312ab32f2037b525 Mon Sep 17 00:00:00 2001 From: Zog Date: Fri, 11 May 2018 14:55:30 +0200 Subject: Refs #6647; Fix specs --- .../views/line_referentials/show.html.slim_spec.rb | 28 +++++++++++++--------- .../stop_area_referentials/show.html.slim_spec.rb | 27 ++++++++++++--------- 2 files changed, 33 insertions(+), 22 deletions(-) (limited to 'spec') diff --git a/spec/views/line_referentials/show.html.slim_spec.rb b/spec/views/line_referentials/show.html.slim_spec.rb index 533b92523..1d93555e6 100644 --- a/spec/views/line_referentials/show.html.slim_spec.rb +++ b/spec/views/line_referentials/show.html.slim_spec.rb @@ -2,20 +2,26 @@ require 'spec_helper' describe "/line_referentials/show", :type => :view do - let!(:line_referential) { assign :line_referential, create(:line_referential) } + let(:line_referential) do + line_referential = create(:line_referential) + assign :line_referential, line_referential.decorate + end before :each do - render + controller.request.path_parameters[:id] = line_referential.id + allow(view).to receive(:params).and_return({action: :show}) + allow(view).to receive(:resource).and_return(line_referential) + + render template: "line_referentials/show", layout: "layouts/application" end - # FIXME See #6647 - # it "should not present syncing infos and button" do - # expect(view.content_for(:page_header_actions)).to_not have_selector("a[href=\"#{view.sync_line_referential_path(line_referential)}\"]") - # end + it "should not present syncing infos and button" do + expect(rendered).to_not have_selector("a[href=\"#{view.sync_line_referential_path(line_referential)}\"]") + end - # with_permission "line_referentials.synchronize" do - # it "should present syncing infos and button" do - # expect(view.content_for(:page_header_actions)).to have_selector("a[href=\"#{view.sync_line_referential_path(line_referential)}\"]", count: 1) - # end - # end + with_permission "line_referentials.synchronize" do + it "should present syncing infos and button" do + expect(rendered).to have_selector("a[href=\"#{view.sync_line_referential_path(line_referential)}\"]", count: 1) + end + end end diff --git a/spec/views/stop_area_referentials/show.html.slim_spec.rb b/spec/views/stop_area_referentials/show.html.slim_spec.rb index 42e2d761b..42569321c 100644 --- a/spec/views/stop_area_referentials/show.html.slim_spec.rb +++ b/spec/views/stop_area_referentials/show.html.slim_spec.rb @@ -2,20 +2,25 @@ require 'spec_helper' describe "/stop_area_referentials/show", :type => :view do - let!(:stop_area_referential) { assign :stop_area_referential, create(:stop_area_referential) } + let(:stop_area_referential) do + stop_area_referential = create(:stop_area_referential) + assign :stop_area_referential, stop_area_referential.decorate + end before :each do - render + controller.request.path_parameters[:id] = stop_area_referential.id + allow(view).to receive(:params).and_return({action: :show}) + allow(view).to receive(:resource).and_return(stop_area_referential) + render template: "stop_area_referentials/show", layout: "layouts/application" end - # FIXME See #6647 - # it "should not present syncing infos and button" do - # expect(view.content_for(:page_header_actions)).to_not have_selector("a[href=\"#{view.sync_stop_area_referential_path(stop_area_referential)}\"]") - # end + it "should not present syncing infos and button" do + expect(rendered).to_not have_selector("a[href=\"#{view.sync_stop_area_referential_path(stop_area_referential)}\"]") + end - # with_permission "stop_area_referentials.synchronize" do - # it "should present syncing infos and button" do - # expect(view.content_for(:page_header_actions)).to have_selector("a[href=\"#{view.sync_stop_area_referential_path(stop_area_referential)}\"]", count: 1) - # end - # end + with_permission "stop_area_referentials.synchronize" do + it "should present syncing infos and button" do + expect(rendered).to have_selector("a[href=\"#{view.sync_stop_area_referential_path(stop_area_referential)}\"]", count: 1) + end + end end -- cgit v1.2.3