diff options
| author | Zog | 2018-05-11 14:55:30 +0200 |
|---|---|---|
| committer | Zog | 2018-05-11 14:55:30 +0200 |
| commit | dcede6f1d323c827ae9e663b312ab32f2037b525 (patch) | |
| tree | 80bc8091b1def694321b39cb72fa5bee3a095c54 | |
| parent | a20e628110933be8cc51f0f0987f25b5948bdfcb (diff) | |
| download | chouette-core-dcede6f1d323c827ae9e663b312ab32f2037b525.tar.bz2 | |
Refs #6647; Fix specs
| -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 |
2 files changed, 33 insertions, 22 deletions
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 |
