summaryrefslogtreecommitdiff
path: root/spec/factories.rb
blob: 2860ef9598d86ab23c41ada201732ba4f79e9ce0 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
FactoryGirl.define do
  factory :activity, class: Activity do
    user { create(:user) }
    subject { create(:favorite) }
  end

  factory :category, class: Category do
    name { FFaker::Name.name }
    slug { FFaker::Name.name.parameterize }
  end

  factory :cake, class: Creation, aliases: [:creation] do
    name { FFaker::Name.name }
    story { FFaker::HipsterIpsum.words(50).join(' ') }
    association :user
    association :category
    factory :published_cake do
      photos_count 1
      after(:create) do |cake, evaluator|
        cake.photos << create(:photo, image: 'spec/fixtures/images/example.png')
      end
    end
  end

  factory :user_session, class: UserSession do
    association :user
    key SecureRandom.urlsafe_base64(32)
    ip FFaker::Internet.ip_v4_address
    factory :active_session do
      accessed_at Time.now
    end
  end

  factory :favorite do
    association :user
    association :creation
  end

  factory :photo, class: Photo do
    image { 'spec/fixtures/images/example.png' }
    content_type { "" }
    original_filename { "" }
    latitude { "" }
    longitude { "" }
    sha256 { "" }
    watermark { "" }
  end

  factory :tag, :class => "ActsAsTaggableOn::Tag" do
    name { FFaker::Name.name }
  end

  factory :tutorial do
    heading { FFaker::Name.name }
    description "well hello there"
    url { FFaker::Internet.http_url }
    image_url { FFaker::Internet.http_url }
    author { FFaker::Name.name }
    author_url { FFaker::Internet.http_url }
    association :user
  end

  factory :user, class: User do
    name { FFaker::Name.name }
    email { FFaker::Internet.email }
    password 'password'
    website { FFaker::Internet.http_url }
    city 'calgary'
    factory :admin do
      admin true
    end
  end

  factory :location do
    latitude "107"
    longitude "99"
    city "Calgary"
    country "Canada"
  end

  factory :tool do
    name { FFaker::Name.name }
    asin { SecureRandom.uuid }
  end
end