aboutsummaryrefslogtreecommitdiffstats
path: root/spec/features/routes_spec.rb
diff options
context:
space:
mode:
authorVlatka Pavisic2017-01-18 11:05:51 +0100
committerVlatka Pavisic2017-01-18 11:05:51 +0100
commit242455e1b6191453f7af98cd29390651ab871e51 (patch)
tree0e75e9c3e1c629c819dbab91ae0f6acd4a859c1a /spec/features/routes_spec.rb
parent307f808e2c812bccccd1c6246ca6b8583be4ef40 (diff)
downloadchouette-core-242455e1b6191453f7af98cd29390651ab871e51.tar.bz2
Refs #2426 : JourneyPattern User permissions
Diffstat (limited to 'spec/features/routes_spec.rb')
-rw-r--r--spec/features/routes_spec.rb74
1 files changed, 32 insertions, 42 deletions
diff --git a/spec/features/routes_spec.rb b/spec/features/routes_spec.rb
index 70d32c777..bc2088712 100644
--- a/spec/features/routes_spec.rb
+++ b/spec/features/routes_spec.rb
@@ -54,6 +54,38 @@ describe "Routes", :type => :feature do
end
end
+ describe 'show' do
+ context 'user has permission to edit journey patterns' do
+ it 'shows edit links for journey patterns' do
+ visit referential_line_route_path(referential, line, route)
+ expect(page).to have_content(I18n.t('actions.edit'))
+ end
+ end
+
+ context 'user does not have permission to edit journey patterns' do
+ it 'does not show edit links for journey patterns' do
+ @user.update_attribute(:permissions, ['journey_patterns.create', 'journey_patterns.destroy'])
+ visit referential_line_route_path(referential, line, route)
+ expect(page).not_to have_content(I18n.t('actions.edit'))
+ end
+ end
+
+ context 'user has permission to destroy journey patterns' do
+ it 'shows destroy links for journey patterns' do
+ visit referential_line_route_path(referential, line, route)
+ expect(page).to have_content(I18n.t('actions.destroy'))
+ end
+ end
+
+ context 'user does not have permission to edit journey patterns' do
+ it 'does not show destroy links for journey patterns' do
+ @user.update_attribute(:permissions, ['journey_patterns.create', 'journey_patterns.edit'])
+ visit referential_line_route_path(referential, line, route)
+ expect(page).not_to have_content(I18n.t('actions.destroy'))
+ end
+ end
+ end
+
describe 'referential line show' do
context 'user has permission to edit routes' do
it 'shows edit buttons for routes' do
@@ -101,45 +133,3 @@ describe "Routes", :type => :feature do
end
end
end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-