summaryrefslogtreecommitdiff
path: root/test/factories.rb
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-04-08 11:49:14 +0200
committerAzul <azul@leap.se>2014-04-08 11:49:14 +0200
commitb6d14dc19dd350a807826e3e097738a36613e083 (patch)
tree093dc5f2f1e773e3ad009d28d1fd24667d3c0ba6 /test/factories.rb
parent2e11e3ca2c7b02fdb5ff54f0bcd766cc5fa39975 (diff)
moving users: app and test files
Diffstat (limited to 'test/factories.rb')
-rw-r--r--test/factories.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/factories.rb b/test/factories.rb
index 6c671f8..98bb39b 100644
--- a/test/factories.rb
+++ b/test/factories.rb
@@ -1,3 +1,37 @@
Dir.glob(Rails.root.join('**','test','factories.rb')) do |factory_file|
require factory_file
end
+FactoryGirl.define do
+
+ factory :user do
+ login { Faker::Internet.user_name }
+ password_verifier "1234ABCD"
+ password_salt "4321AB"
+
+ factory :user_with_settings do
+ email_forward { Faker::Internet.email }
+ email_aliases_attributes do
+ {:a => Faker::Internet.user_name + '@' + APP_CONFIG[:domain]}
+ end
+ end
+
+ factory :admin_user do
+ after(:build) do |admin|
+ admin.stubs(:is_admin?).returns(true)
+ end
+ end
+ end
+
+ factory :token do
+ user
+ end
+
+ factory :pgp_key do
+ keyblock <<-EOPGP
+-----BEGIN PGP PUBLIC KEY BLOCK-----
++Dummy+PGP+KEY+++Dummy+PGP+KEY+++Dummy+PGP+KEY+++Dummy+PGP+KEY+
+#{SecureRandom.base64(4032)}
+-----END PGP PUBLIC KEY BLOCK-----
+ EOPGP
+ end
+end