-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfactories.rb
executable file
·70 lines (59 loc) · 1.49 KB
/
factories.rb
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
FactoryGirl.define do
sequence(:random_string) do |n|
alphabets = "abcdefghijklmnopqrstuvwxyz"
len = rand(1..10)
random_string = String.new
len.times do
random_string << alphabets[rand(0..25)]
end
random_string
end
factory :user, aliases: [:author, :trader] do
sequence(:login_id) { |n| "foo#{n}" }
email { "#{login_id}@example.com" }
name "The Foo"
password "1foobar"
password_confirmation "1foobar"
factory :admin do
admin true
end
end
factory :state, class: Common::State do
sequence(:name) { |n| "Foo#{n} State" }
end
factory :activity, class: Common::Activity do
sequence(:name) { |n| "Foo#{n} Activity" }
end
factory :trail, class: Common::Trail do
name "Foo Trail"
length 10
description "This is a great trail"
state
# activities
end
factory :missing_trail, class: Common::MissingTrail do
user_name "Foo"
user_email "[email protected]"
sequence(:info) { |n| "Tested path- #{n}" }
end
factory :update, class: Community::Update do
content "Lorem ipsum"
author
trail
end
factory :tag, class: Site::Tag do
name { generate(:random_string) }
end
factory :log, class: Corner::Log do
title "Title"
content "Lorem ipsum"
user
end
factory :trade, class: Community::Trade do
sequence(:gear) { |n| "Gear#{n}" }
trade_type 'sell'
description "Lorem ipsum"
trade_location 'Some Location'
trader
end
end