aboutsummaryrefslogtreecommitdiffstats
path: root/spec/features/routes_spec.rb
diff options
context:
space:
mode:
authorVlatka Pavisic2017-01-16 15:21:11 +0100
committerVlatka Pavisic2017-01-16 15:21:11 +0100
commit307f808e2c812bccccd1c6246ca6b8583be4ef40 (patch)
tree694dc741ecef8f502097f5c79e5217f933bd727b /spec/features/routes_spec.rb
parent9e69db1f517d15ab52cd169e3a5774d9071c3630 (diff)
downloadchouette-core-307f808e2c812bccccd1c6246ca6b8583be4ef40.tar.bz2
Refs #2399 : User routes permissions
Diffstat (limited to 'spec/features/routes_spec.rb')
-rw-r--r--spec/features/routes_spec.rb88
1 files changed, 88 insertions, 0 deletions
diff --git a/spec/features/routes_spec.rb b/spec/features/routes_spec.rb
index 5aea98c90..70d32c777 100644
--- a/spec/features/routes_spec.rb
+++ b/spec/features/routes_spec.rb
@@ -54,4 +54,92 @@ describe "Routes", :type => :feature do
end
end
+ describe 'referential line show' do
+ context 'user has permission to edit routes' do
+ it 'shows edit buttons for routes' do
+ visit referential_line_path(referential, line)
+ expect(page).to have_css('span.fa.fa-pencil')
+ end
+ end
+
+ context 'user does not have permission to edit routes' do
+ it 'does not show edit buttons for routes' do
+ @user.update_attribute(:permissions, ['routes.create', 'routes.destroy'])
+ visit referential_line_path(referential, line)
+ expect(page).not_to have_css('span.fa.fa-pencil')
+ end
+ end
+
+ context 'user has permission to create routes' do
+ it 'shows link to a create route page' do
+ visit referential_line_path(referential, line)
+ expect(page).to have_content(I18n.t('routes.actions.new'))
+ end
+ end
+
+ context 'user does not have permission to create routes' do
+ it 'does not show link to a create route page' do
+ @user.update_attribute(:permissions, ['routes.edit', 'routes.destroy'])
+ visit referential_line_path(referential, line)
+ expect(page).not_to have_content(I18n.t('routes.actions.new'))
+ end
+ end
+
+ context 'user has permission to destroy routes' do
+ it 'shows destroy buttons for routes' do
+ visit referential_line_path(referential, line)
+ expect(page).to have_css('span.fa.fa-trash-o')
+ end
+ end
+
+ context 'user does not have permission to destroy routes' do
+ it 'does not show destroy buttons for routes' do
+ @user.update_attribute(:permissions, ['routes.edit', 'routes.create'])
+ visit referential_line_path(referential, line)
+ expect(page).not_to have_css('span.fa.fa-trash-o')
+ end
+ end
+ end
end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+