-
Notifications
You must be signed in to change notification settings - Fork 1
/
blueprints.rb
92 lines (80 loc) · 1.58 KB
/
blueprints.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Object blueprints for Machinist.
require 'machinist/active_record'
require 'sham'
require 'ffaker'
LETTERS = ('A'..'Z').to_a
Event.blueprint do
name {Sham.event_name}
description
street
street2
city
state
zip
date
calendar
created_by {User.make}
end
Acts::Addressed::State.blueprint do
country
name {Sham.generic_name}
code
end
Acts::Addressed::Country.blueprint do
name {Sham.generic_name}
code
end
Calendar.blueprint do
name {Sham.calendar_name}
end
User.blueprint do
firstname
lastname
email
password
password_confirmation {self.password}
street
street2
city
state
zip
active {true}
end
User.blueprint(:inactive) do
active {false}
end
Commitment.blueprint do
event
user
status {true}
end
Permission.blueprint do
user
role
calendar
end
Permission.blueprint(:admin) do
role {Role.make :admin}
end
Role.blueprint do
name {'user'}
end
Role.blueprint :admin do
name {'admin'}
end
Sham.define do
calendar_name {Faker::Name.name + "'s calendar"}
city {Faker::Address.city}
date(:unique => false) {Date.civil(rand(10) + 2000, rand(12) + 1, rand(28) + 1)}
description {Faker::Lorem.paragraph}
email {Faker::Internet.email}
firstname {Faker::Name.first_name}
lastname {Faker::Name.last_name}
generic_name {Faker::Name.last_name}
password {(1..(rand(15) + 4)).map{(32..127).to_a.rand.chr}.join}
street {Faker::Address.street_address}
street2 {Faker::Address.secondary_address}
zip {Faker::Address.zip_code}
code {LETTERS.rand + LETTERS.rand} # 2 random letters
event_name {Faker::Lorem.words(3).join(' ')}
end