aboutsummaryrefslogtreecommitdiffstats
path: root/spec/factories/user.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/factories/user.rb')
-rw-r--r--spec/factories/user.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/factories/user.rb b/spec/factories/user.rb
new file mode 100644
index 0000000..94fe1d0
--- /dev/null
+++ b/spec/factories/user.rb
@@ -0,0 +1,27 @@
+require 'refinerycms/all'
+require 'refinery/role'
+
+Factory.define :user, :class => ::Refinery::User do |u|
+ u.sequence(:username) { |n| "person#{n}" }
+ u.sequence(:email) { |n| "person#{n}@cucumber.com" }
+ u.password "greenandjuicy"
+ u.password_confirmation "greenandjuicy"
+end
+
+Factory.define :refinery_user, :parent => :user do |u|
+ u.roles { [ ::Refinery::Role[:refinery] ] }
+
+ u.after_create do |user|
+ ::Refinery::Plugins.registered.each_with_index do |plugin, index|
+ user.plugins.create(:name => plugin.name, :position => index)
+ end
+ end
+end
+
+Factory.define :refinery_translator, :parent => :user do |u|
+ u.roles { [ ::Refinery::Role[:refinery], ::Refinery::Role[:translator] ] }
+
+ u.after_create do |user|
+ user.plugins.create(:name => 'refinery_pages', :position => 0)
+ end
+end