aboutsummaryrefslogtreecommitdiffstats
path: root/spec/views
diff options
context:
space:
mode:
authorZog2017-12-18 17:18:25 +0100
committerZog2017-12-19 14:21:52 +0100
commit98c08c6fae5b0bf59231b3e402ca91307c200297 (patch)
tree51dc7a30198d6fa83df13948fc2223effb01cc28 /spec/views
parent3aa5ff0d1f5e74b4c46c14e6240e7def82f0451d (diff)
downloadchouette-core-98c08c6fae5b0bf59231b3e402ca91307c200297.tar.bz2
Refs #5333@1.5h; Use permissions to sync StopAreas and Lines
- add missing policies - update permissions translator - update views to check for the permission - update views helper to check for the permission - uipdate controllers to check for the permission
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/line_referentials/show.html.slim_spec.rb22
-rw-r--r--spec/views/line_referentials/stop_area_referentials/show.html.slim_spec.rb22
2 files changed, 44 insertions, 0 deletions
diff --git a/spec/views/line_referentials/show.html.slim_spec.rb b/spec/views/line_referentials/show.html.slim_spec.rb
new file mode 100644
index 000000000..0516677cb
--- /dev/null
+++ b/spec/views/line_referentials/show.html.slim_spec.rb
@@ -0,0 +1,22 @@
+require 'spec_helper'
+
+describe "/line_referentials/show", :type => :view do
+
+ let!(:line_referential) { assign :line_referential, create(:line_referential) }
+
+ before :each do
+ render
+ end
+
+ 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)}\"]")
+ expect(view.content_for(:page_header_meta)).to_not have_selector(".last-update")
+ 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)
+ expect(view.content_for(:page_header_meta)).to have_selector(".last-update", count: 1)
+ end
+ end
+end
diff --git a/spec/views/line_referentials/stop_area_referentials/show.html.slim_spec.rb b/spec/views/line_referentials/stop_area_referentials/show.html.slim_spec.rb
new file mode 100644
index 000000000..71a8d16f5
--- /dev/null
+++ b/spec/views/line_referentials/stop_area_referentials/show.html.slim_spec.rb
@@ -0,0 +1,22 @@
+require 'spec_helper'
+
+describe "/stop_area_referentials/show", :type => :view do
+
+ let!(:stop_area_referential) { assign :stop_area_referential, create(:stop_area_referential) }
+
+ before :each do
+ render
+ end
+
+ 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)}\"]")
+ expect(view.content_for(:page_header_meta)).to_not have_selector(".last-update")
+ 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)
+ expect(view.content_for(:page_header_meta)).to have_selector(".last-update", count: 1)
+ end
+ end
+end