aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorRobert2017-07-10 17:39:43 +0200
committerRobert2017-07-10 17:39:43 +0200
commitf31fc0bb6f1d115d8ad23282ffe335c8fad7e4fe (patch)
tree60f9515b311e3d491072befb9e28099c43c842ee /spec
parent825eec70d1591f5288d3889dad3694344d1af296 (diff)
parent64e16e9525961066a8d4f2770e8ccb8472a15956 (diff)
downloadchouette-core-f31fc0bb6f1d115d8ad23282ffe335c8fad7e4fe.tar.bz2
Merge branch 'master' into staging
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/stif/permission_translator_spec.rb10
-rw-r--r--spec/support/permissions.rb28
2 files changed, 38 insertions, 0 deletions
diff --git a/spec/lib/stif/permission_translator_spec.rb b/spec/lib/stif/permission_translator_spec.rb
new file mode 100644
index 000000000..3672c7937
--- /dev/null
+++ b/spec/lib/stif/permission_translator_spec.rb
@@ -0,0 +1,10 @@
+RSpec.describe Stif::PermissionTranslator do
+
+ context "SSO Permission boiv:read:offer →" do
+
+ it "sessions:create only" do
+ expect( described_class.translate(%w{boiv:read:offer}) ).to eq(%w{sessions:create})
+ end
+
+ end
+end
diff --git a/spec/support/permissions.rb b/spec/support/permissions.rb
new file mode 100644
index 000000000..a13010f65
--- /dev/null
+++ b/spec/support/permissions.rb
@@ -0,0 +1,28 @@
+module Support
+ module Permissions extend self
+
+ def all_permissions
+ @__all_permissions__ ||= _destructive_permissions << 'sessions:create'
+ end
+
+ private
+
+ def _destructive_permissions
+ _permitted_resources.product( %w{create destroy update} ).map{ |model_action| model_action.join('.') }
+ end
+
+ def _permitted_resources
+ %w[
+ access_points
+ connection_links
+ footnotes
+ journey_patterns
+ referentials
+ routes
+ routing_constraint_zones
+ time_tables
+ vehicle_journeys
+ ]
+ end
+ end
+end