summaryrefslogtreecommitdiff
path: root/test/factories.rb
blob: ac9333c8b08f1f90ebee3a090ecf48fddc21cf9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
ENGINE_FACTORY_FILES = Rails.root.join('engines','*','test','factories.rb')
Dir.glob(ENGINE_FACTORY_FILES) 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