]> git.openstreetmap.org Git - rails.git/blobdiff - test/factories/user.rb
use a controller method to handle cancan denials
[rails.git] / test / factories / user.rb
index 802fedd91c71cdb25e4e053b04ff287b36211b4a..d6ee1fa8c03249f9f4216cde09b890c921936bc0 100644 (file)
@@ -1,4 +1,4 @@
-FactoryGirl.define do
+FactoryBot.define do
   factory :user do
     sequence(:email) { |n| "user#{n}@example.com" }
     sequence(:display_name) { |n| "User #{n}" }
@@ -46,5 +46,13 @@ FactoryGirl.define do
         create(:user_role, :role => "administrator", :user => user)
       end
     end
+
+    factory :super_user do
+      after(:create) do |user, _evaluator|
+        UserRole::ALL_ROLES.each do |role|
+          create(:user_role, :role => role, :user => user)
+        end
+      end
+    end
   end
 end