diff options
Diffstat (limited to 'spec/views')
| -rw-r--r-- | spec/views/imports/show.html.slim_spec.rb | 1 | ||||
| -rw-r--r-- | spec/views/line_referentials/show.html.slim_spec.rb | 28 | ||||
| -rw-r--r-- | spec/views/stop_area_referentials/show.html.slim_spec.rb | 27 |
3 files changed, 34 insertions, 22 deletions
diff --git a/spec/views/imports/show.html.slim_spec.rb b/spec/views/imports/show.html.slim_spec.rb index faf473758..058490ca1 100644 --- a/spec/views/imports/show.html.slim_spec.rb +++ b/spec/views/imports/show.html.slim_spec.rb @@ -9,6 +9,7 @@ RSpec.describe '/imports/show', type: :view do before do assign :import, workbench_import.decorate( context: {workbench: workbench} ) + assign :workbench, workbench render end 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 |
