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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
FactoryGirl.define do
factory :exercise do
name { FFaker::Internet.user_name }
factory :squat do
name 'Squat'
end
end
factory :exercise_set do
association :exercise
association :workout
target_repetitions { rand(12) }
target_weight { rand(400) }
factory :work_set, class: "WorkSet"
end
factory :program do
name { FFaker::Internet.user_name }
end
factory :workout do
association :user
association :routine
occurred_at { DateTime.now }
body_weight { rand(250) }
end
factory :user do
username { FFaker::Internet.user_name }
email { FFaker::Internet.email }
password "password"
password_confirmation "password"
terms_and_conditions "1"
end
factory :routine do
association :program
name { FFaker::Internet.user_name }
end
factory :email, class: OpenStruct do
to [{
full: "cf9b756e-789d-4bbb-aee7-2c8298bb69a7@stronglifters.com",
email: "cf9b756e-789d-4bbb-aee7-2c8298bb69a7@stronglifters.com",
token: "cf9b756e-789d-4bbb-aee7-2c8298bb69a7",
host: "stronglifters.com",
name: nil
}]
from({
token: "from_user",
host: "email.com",
email: "from_email@email.com",
full: "From User <from_user@email.com>",
name: "From User"
})
subject "email subject"
body "Hello!"
attachments { [] }
trait :with_attachment do
attachments {[
ActionDispatch::Http::UploadedFile.new({
filename: "spreadsheet-stronglifts.csv",
type: "text/plain",
tempfile: File.new(
"#{File.expand_path(File.dirname(__FILE__))}/fixtures/spreadsheet-stronglifts.csv"
)
})
]}
end
end
factory :gym do
name { FFaker::Internet.user_name }
association :location
factory :calgary_gym do
location { create(:calgary) }
end
factory :edmonton_gym do
location { create(:edmonton) }
end
factory :portland_gym do
location { create(:portland) }
end
end
factory :user_session, class: UserSession do
association :user
ip FFaker::Internet.ip_v4_address
factory :active_session do
accessed_at Time.current
end
end
factory :location do
latitude { rand(90.0) }
longitude { rand(180.0) }
address { FFaker::Address.street_address }
city { FFaker::AddressCA.city }
region { FFaker::AddressCA.province }
postal_code { FFaker::AddressCA.postal_code }
country { FFaker::Address.country }
factory :calgary do
latitude { 51.0130333 }
longitude { -114.2142365 }
city { "Calgary" }
region { "AB" }
country { "CA" }
end
factory :edmonton do
latitude { 53.5557956 }
longitude { -113.6340292 }
city { "Edmonton" }
region { "AB" }
country { "CA" }
end
factory :portland do
latitude { 45.542415 }
longitude { -122.7244614 }
city { "Portland" }
region { "OR" }
country { "US" }
end
factory :no_where do
latitude { 0.0 }
longitude { 0.0 }
city { "" }
region { "" }
country { "" }
postal_code { "" }
end
end
end
|