factory_girl 2.6.1 → 2.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/gemfiles/2.3.gemfile.lock +1 -1
- data/gemfiles/3.0.gemfile.lock +1 -1
- data/gemfiles/3.1.gemfile.lock +1 -1
- data/gemfiles/3.2.gemfile.lock +1 -1
- data/lib/factory_girl/factory.rb +1 -1
- data/lib/factory_girl/syntax/vintage.rb +2 -2
- data/lib/factory_girl/version.rb +1 -1
- data/spec/acceptance/traits_spec.rb +9 -0
- metadata +176 -113
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/gemfiles/2.3.gemfile.lock
CHANGED
data/gemfiles/3.0.gemfile.lock
CHANGED
data/gemfiles/3.1.gemfile.lock
CHANGED
data/gemfiles/3.2.gemfile.lock
CHANGED
data/lib/factory_girl/factory.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module FactoryGirl
|
2
2
|
module Syntax
|
3
3
|
module Vintage
|
4
|
-
module Factory
|
4
|
+
module ::Factory
|
5
5
|
# Defines a new factory that can be used by the build strategies (create and
|
6
6
|
# build) to build new objects.
|
7
7
|
#
|
@@ -140,7 +140,7 @@ module FactoryGirl
|
|
140
140
|
# Example:
|
141
141
|
# Factory(:user, :name => 'Joe')
|
142
142
|
def Factory(name, attrs = {})
|
143
|
-
Factory.default_strategy(name, attrs)
|
143
|
+
::Factory.default_strategy(name, attrs)
|
144
144
|
end
|
145
145
|
end
|
146
146
|
end
|
data/lib/factory_girl/version.rb
CHANGED
@@ -60,6 +60,10 @@ describe "an instance generated by a factory with multiple traits" do
|
|
60
60
|
name "Judy"
|
61
61
|
end
|
62
62
|
|
63
|
+
factory :female_great_user do
|
64
|
+
great
|
65
|
+
end
|
66
|
+
|
63
67
|
factory :female_admin_judy, :traits => [:admin]
|
64
68
|
end
|
65
69
|
|
@@ -167,6 +171,11 @@ describe "an instance generated by a factory with multiple traits" do
|
|
167
171
|
subject { FactoryGirl.create(:user_without_admin_scoping) }
|
168
172
|
it { expect { subject }.to raise_error(ArgumentError, "Trait not registered: admin_trait") }
|
169
173
|
end
|
174
|
+
|
175
|
+
context "child factory using grandparents' trait" do
|
176
|
+
subject { FactoryGirl.create(:female_great_user) }
|
177
|
+
its(:great) { should == "GREAT!!!" }
|
178
|
+
end
|
170
179
|
end
|
171
180
|
|
172
181
|
describe "traits with callbacks" do
|
metadata
CHANGED
@@ -1,156 +1,209 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: factory_girl
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 2
|
8
|
+
- 6
|
9
|
+
- 2
|
10
|
+
version: 2.6.2
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Joe Ferris
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2012-03-09 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: activesupport
|
16
|
-
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
24
|
none: false
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 17
|
29
|
+
segments:
|
30
|
+
- 2
|
31
|
+
- 3
|
32
|
+
- 9
|
21
33
|
version: 2.3.9
|
22
34
|
type: :runtime
|
23
|
-
|
24
|
-
|
25
|
-
- !ruby/object:Gem::Dependency
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
26
37
|
name: rspec
|
27
|
-
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
28
40
|
none: false
|
29
|
-
requirements:
|
41
|
+
requirements:
|
30
42
|
- - ~>
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 2
|
47
|
+
- 0
|
48
|
+
version: "2.0"
|
33
49
|
type: :development
|
34
|
-
|
35
|
-
|
36
|
-
- !ruby/object:Gem::Dependency
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
37
52
|
name: cucumber
|
38
|
-
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
39
55
|
none: false
|
40
|
-
requirements:
|
56
|
+
requirements:
|
41
57
|
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 23
|
60
|
+
segments:
|
61
|
+
- 1
|
62
|
+
- 0
|
63
|
+
- 0
|
43
64
|
version: 1.0.0
|
44
65
|
type: :development
|
45
|
-
|
46
|
-
|
47
|
-
- !ruby/object:Gem::Dependency
|
66
|
+
version_requirements: *id003
|
67
|
+
- !ruby/object:Gem::Dependency
|
48
68
|
name: timecop
|
49
|
-
|
69
|
+
prerelease: false
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
50
71
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
hash: 3
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
version: "0"
|
55
79
|
type: :development
|
56
|
-
|
57
|
-
|
58
|
-
- !ruby/object:Gem::Dependency
|
80
|
+
version_requirements: *id004
|
81
|
+
- !ruby/object:Gem::Dependency
|
59
82
|
name: rcov
|
60
|
-
|
83
|
+
prerelease: false
|
84
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
61
85
|
none: false
|
62
|
-
requirements:
|
63
|
-
- -
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
hash: 3
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
version: "0"
|
66
93
|
type: :development
|
67
|
-
|
68
|
-
|
69
|
-
- !ruby/object:Gem::Dependency
|
94
|
+
version_requirements: *id005
|
95
|
+
- !ruby/object:Gem::Dependency
|
70
96
|
name: aruba
|
71
|
-
|
97
|
+
prerelease: false
|
98
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
72
99
|
none: false
|
73
|
-
requirements:
|
74
|
-
- -
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
hash: 3
|
104
|
+
segments:
|
105
|
+
- 0
|
106
|
+
version: "0"
|
77
107
|
type: :development
|
78
|
-
|
79
|
-
|
80
|
-
- !ruby/object:Gem::Dependency
|
108
|
+
version_requirements: *id006
|
109
|
+
- !ruby/object:Gem::Dependency
|
81
110
|
name: mocha
|
82
|
-
|
111
|
+
prerelease: false
|
112
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
83
113
|
none: false
|
84
|
-
requirements:
|
85
|
-
- -
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
hash: 3
|
118
|
+
segments:
|
119
|
+
- 0
|
120
|
+
version: "0"
|
88
121
|
type: :development
|
89
|
-
|
90
|
-
|
91
|
-
- !ruby/object:Gem::Dependency
|
122
|
+
version_requirements: *id007
|
123
|
+
- !ruby/object:Gem::Dependency
|
92
124
|
name: bourne
|
93
|
-
|
125
|
+
prerelease: false
|
126
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
94
127
|
none: false
|
95
|
-
requirements:
|
96
|
-
- -
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
hash: 3
|
132
|
+
segments:
|
133
|
+
- 0
|
134
|
+
version: "0"
|
99
135
|
type: :development
|
100
|
-
|
101
|
-
|
102
|
-
- !ruby/object:Gem::Dependency
|
136
|
+
version_requirements: *id008
|
137
|
+
- !ruby/object:Gem::Dependency
|
103
138
|
name: appraisal
|
104
|
-
|
139
|
+
prerelease: false
|
140
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
105
141
|
none: false
|
106
|
-
requirements:
|
142
|
+
requirements:
|
107
143
|
- - ~>
|
108
|
-
- !ruby/object:Gem::Version
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
hash: 3
|
146
|
+
segments:
|
147
|
+
- 0
|
148
|
+
- 3
|
149
|
+
- 8
|
109
150
|
version: 0.3.8
|
110
151
|
type: :development
|
111
|
-
|
112
|
-
|
113
|
-
- !ruby/object:Gem::Dependency
|
152
|
+
version_requirements: *id009
|
153
|
+
- !ruby/object:Gem::Dependency
|
114
154
|
name: sqlite3-ruby
|
115
|
-
|
155
|
+
prerelease: false
|
156
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
116
157
|
none: false
|
117
|
-
requirements:
|
118
|
-
- -
|
119
|
-
- !ruby/object:Gem::Version
|
120
|
-
|
158
|
+
requirements:
|
159
|
+
- - ">="
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
hash: 3
|
162
|
+
segments:
|
163
|
+
- 0
|
164
|
+
version: "0"
|
121
165
|
type: :development
|
122
|
-
|
123
|
-
|
124
|
-
- !ruby/object:Gem::Dependency
|
166
|
+
version_requirements: *id010
|
167
|
+
- !ruby/object:Gem::Dependency
|
125
168
|
name: yard
|
126
|
-
|
169
|
+
prerelease: false
|
170
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
127
171
|
none: false
|
128
|
-
requirements:
|
129
|
-
- -
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
|
172
|
+
requirements:
|
173
|
+
- - ">="
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
hash: 3
|
176
|
+
segments:
|
177
|
+
- 0
|
178
|
+
version: "0"
|
132
179
|
type: :development
|
133
|
-
|
134
|
-
|
135
|
-
- !ruby/object:Gem::Dependency
|
180
|
+
version_requirements: *id011
|
181
|
+
- !ruby/object:Gem::Dependency
|
136
182
|
name: bluecloth
|
137
|
-
|
183
|
+
prerelease: false
|
184
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
138
185
|
none: false
|
139
|
-
requirements:
|
140
|
-
- -
|
141
|
-
- !ruby/object:Gem::Version
|
142
|
-
|
186
|
+
requirements:
|
187
|
+
- - ">="
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
hash: 3
|
190
|
+
segments:
|
191
|
+
- 0
|
192
|
+
version: "0"
|
143
193
|
type: :development
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
194
|
+
version_requirements: *id012
|
195
|
+
description: |-
|
196
|
+
factory_girl provides a framework and DSL for defining and
|
197
|
+
using factories - less error-prone, more explicit, and
|
198
|
+
all-around easier to work with than fixtures.
|
149
199
|
email: jferris@thoughtbot.com
|
150
200
|
executables: []
|
201
|
+
|
151
202
|
extensions: []
|
203
|
+
|
152
204
|
extra_rdoc_files: []
|
153
|
-
|
205
|
+
|
206
|
+
files:
|
154
207
|
- .autotest
|
155
208
|
- .gitignore
|
156
209
|
- .rspec
|
@@ -295,30 +348,40 @@ files:
|
|
295
348
|
- spec/support/shared_examples/strategy.rb
|
296
349
|
homepage: https://github.com/thoughtbot/factory_girl
|
297
350
|
licenses: []
|
351
|
+
|
298
352
|
post_install_message:
|
299
353
|
rdoc_options: []
|
300
|
-
|
354
|
+
|
355
|
+
require_paths:
|
301
356
|
- lib
|
302
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
357
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
303
358
|
none: false
|
304
|
-
requirements:
|
305
|
-
- -
|
306
|
-
- !ruby/object:Gem::Version
|
359
|
+
requirements:
|
360
|
+
- - ">="
|
361
|
+
- !ruby/object:Gem::Version
|
362
|
+
hash: 57
|
363
|
+
segments:
|
364
|
+
- 1
|
365
|
+
- 8
|
366
|
+
- 7
|
307
367
|
version: 1.8.7
|
308
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
368
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
309
369
|
none: false
|
310
|
-
requirements:
|
311
|
-
- -
|
312
|
-
- !ruby/object:Gem::Version
|
313
|
-
|
370
|
+
requirements:
|
371
|
+
- - ">="
|
372
|
+
- !ruby/object:Gem::Version
|
373
|
+
hash: 3
|
374
|
+
segments:
|
375
|
+
- 0
|
376
|
+
version: "0"
|
314
377
|
requirements: []
|
378
|
+
|
315
379
|
rubyforge_project:
|
316
380
|
rubygems_version: 1.8.16
|
317
381
|
signing_key:
|
318
382
|
specification_version: 3
|
319
|
-
summary: factory_girl provides a framework and DSL for defining and using model instance
|
320
|
-
|
321
|
-
test_files:
|
383
|
+
summary: factory_girl provides a framework and DSL for defining and using model instance factories.
|
384
|
+
test_files:
|
322
385
|
- Appraisals
|
323
386
|
- features/factory_girl_steps.feature
|
324
387
|
- features/find_definitions.feature
|