aboutsummaryrefslogtreecommitdiffstats
path: root/spec/support
diff options
context:
space:
mode:
authorRobert2017-07-10 22:19:01 +0200
committerRobert2017-07-10 22:32:00 +0200
commit25d99e6fc46db9a37fcbcae83b008ff96bc00520 (patch)
treeae30ed535a2eda288fca628ec4b5c83470bc14a3 /spec/support
parent1ab9c3364ffcd777dae39bd9154dca031cc00db0 (diff)
downloadchouette-core-25d99e6fc46db9a37fcbcae83b008ff96bc00520.tar.bz2
Refs: #4021@1.5h; Added spec for incorrectly shown `Créer` button on calenders#index view and made them pass
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/devise.rb32
1 files changed, 6 insertions, 26 deletions
diff --git a/spec/support/devise.rb b/spec/support/devise.rb
index 28703c072..46249fef2 100644
--- a/spec/support/devise.rb
+++ b/spec/support/devise.rb
@@ -3,13 +3,11 @@ module DeviseRequestHelper
def login_user
organisation = Organisation.where(:code => "first").first_or_create(attributes_for(:organisation))
- @user ||= create(:user, :organisation => organisation,
- :permissions => ['routes.create', 'routes.update', 'routes.destroy', 'journey_patterns.create', 'journey_patterns.update', 'journey_patterns.destroy',
- 'vehicle_journeys.create', 'vehicle_journeys.update', 'vehicle_journeys.destroy', 'time_tables.create', 'time_tables.update', 'time_tables.destroy',
- 'footnotes.update', 'footnotes.create', 'footnotes.destroy', 'routing_constraint_zones.create', 'routing_constraint_zones.update', 'routing_constraint_zones.destroy',
- 'access_points.create', 'access_points.update', 'access_points.destroy', 'access_links.create', 'access_links.update', 'access_links.destroy',
- 'connection_links.create', 'connection_links.update', 'connection_links.destroy', 'route_sections.create', 'route_sections.update', 'route_sections.destroy',
- 'referentials.create', 'referentials.update', 'referentials.destroy'])
+ @user ||=
+ create(:user,
+ :organisation => organisation,
+ :permissions => Support::Permissions.all_permissions)
+
login_as @user, :scope => :user
# post_via_redirect user_session_path, 'user[email]' => @user.email, 'user[password]' => @user.password
end
@@ -38,28 +36,12 @@ end
module DeviseControllerHelper
def setup_user
- _all_actions = %w{create destroy update}
- _all_resources = %w{ access_links
- access_points
- connection_links
- footnotes
- journey_patterns
- referentials
- route_sections
- routes
- routing_constraint_zones
- time_tables
- vehicle_journeys }
- join_with = -> (separator) do
- -> (ary) { ary.join(separator) }
- end
-
before do
@request.env["devise.mapping"] = Devise.mappings[:user]
organisation = Organisation.where(:code => "first").first_or_create(attributes_for(:organisation))
@user = create(:user,
organisation: organisation,
- permissions: _all_resources.product( _all_actions ).map(&join_with.('.')))
+ permissions: Support::Permissions.all_permissions)
end
end
@@ -70,8 +52,6 @@ module DeviseControllerHelper
end
end
- private
-
end
RSpec.configure do |config|