factory_girl 2.6.2 → 2.6.3

Sign up to get free protection for your applications and to get access to all the features.
data/Changelog CHANGED
@@ -1,3 +1,19 @@
1
+ 2.6.3 (March 9, 2012)
2
+ Fix issue with traits not being present the first time a factory is accessed
3
+ Update available Cucumber step definitions to not require a trialing colon
4
+ when building a table of attributes to instantiate records with
5
+
6
+ 2.6.2 (March 9, 2012)
7
+ Allow factories to use all their ancestors' traits
8
+ Ignore bin dir generated by bundler
9
+ Namespace ::Factory as top-level to fix vintage syntax issue with
10
+ Ruby 1.9.2-p3p18
11
+
12
+ 2.6.1 (March 2, 2012)
13
+ Use FactoryGirl.reload in specs
14
+ Clean up running named factories with a particular strategy with
15
+ FactoryGirl::FactoryRunner
16
+
1
17
  2.6.0 (February 17, 2012)
2
18
  Improve documentation of has_many associations in the GETTING_STARTED
3
19
  document
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- factory_girl (2.6.2)
4
+ factory_girl (2.6.3)
5
5
  activesupport (>= 2.3.9)
6
6
 
7
7
  GEM
@@ -8,6 +8,14 @@ Feature: Use step definitions generated by factories
8
8
  | title | body |
9
9
  | a fun title | here is the content |
10
10
 
11
+ Scenario: create a post and verify its attributes without the trailing colon
12
+ Given the following post exists
13
+ | Title | Body |
14
+ | a fun title | here is the content |
15
+ Then I should find the following for the last post:
16
+ | title | body |
17
+ | a fun title | here is the content |
18
+
11
19
  Scenario: create a post without a table and verify its attributes
12
20
  Given a post exists with a title of "a fun title"
13
21
  Then I should find the following for the last post:
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/joshuaclayton/dev/gems/factory_girl
3
3
  specs:
4
- factory_girl (2.6.2)
4
+ factory_girl (2.6.3)
5
5
  activesupport (>= 2.3.9)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/joshuaclayton/dev/gems/factory_girl
3
3
  specs:
4
- factory_girl (2.6.2)
4
+ factory_girl (2.6.3)
5
5
  activesupport (>= 2.3.9)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/joshuaclayton/dev/gems/factory_girl
3
3
  specs:
4
- factory_girl (2.6.2)
4
+ factory_girl (2.6.3)
5
5
  activesupport (>= 2.3.9)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/joshuaclayton/dev/gems/factory_girl
3
3
  specs:
4
- factory_girl (2.6.2)
4
+ factory_girl (2.6.3)
5
5
  activesupport (>= 2.3.9)
6
6
 
7
7
  GEM
@@ -16,6 +16,8 @@ module FactoryGirl
16
16
  strategy_override ||= @strategy
17
17
  factory = FactoryGirl.factory_by_name(@name)
18
18
 
19
+ factory.compile
20
+
19
21
  if @traits.any?
20
22
  factory = factory.with_traits(@traits)
21
23
  end
@@ -97,7 +97,7 @@ World(FactoryGirlStepHelpers)
97
97
  FactoryGirl.factories.each do |factory|
98
98
  factory.compile
99
99
  factory.human_names.each do |human_name|
100
- Given /^the following (?:#{human_name}|#{human_name.pluralize}) exists?:$/i do |table|
100
+ Given /^the following (?:#{human_name}|#{human_name.pluralize}) exists?:?$/i do |table|
101
101
  table.hashes.each do |human_hash|
102
102
  attributes = convert_human_hash_to_attribute_hash(human_hash, factory.associations)
103
103
  FactoryGirl.create(factory.name, attributes)
@@ -1,4 +1,4 @@
1
1
  module FactoryGirl
2
- VERSION = "2.6.2"
2
+ VERSION = "2.6.3"
3
3
  end
4
4
 
@@ -395,3 +395,27 @@ describe "inline traits overriding existing attributes" do
395
395
  FactoryGirl.build(:extended_declined_user, :accepted, :status => "completely overridden").status.should == "completely overridden"
396
396
  end
397
397
  end
398
+
399
+ describe "making sure the factory is properly compiled the first time we want to instantiate it" do
400
+ before do
401
+ define_model("User", :role => :string, :gender => :string, :age => :integer)
402
+
403
+ FactoryGirl.define do
404
+ factory :user do
405
+ trait(:female) { gender "female" }
406
+ trait(:admin) { role "admin" }
407
+
408
+ factory :female_user do
409
+ female
410
+ end
411
+ end
412
+ end
413
+ end
414
+
415
+ it "can honor traits on the very first call" do
416
+ user = FactoryGirl.build(:female_user, :admin, :age => 30)
417
+ user.gender.should == 'female'
418
+ user.age.should == 30
419
+ user.role.should == 'admin'
420
+ end
421
+ end
@@ -27,6 +27,7 @@ shared_examples_for "strategy with association support" do |factory_girl_strateg
27
27
 
28
28
  before do
29
29
  FactoryGirl.stubs(:factory_by_name => factory)
30
+ factory.stubs(:compile)
30
31
  factory.stubs(:run)
31
32
  end
32
33
 
@@ -52,6 +53,7 @@ shared_examples_for "strategy with :strategy => :build" do |factory_girl_strateg
52
53
 
53
54
  before do
54
55
  FactoryGirl.stubs(:factory_by_name => factory)
56
+ factory.stubs(:compile)
55
57
  factory.stubs(:run)
56
58
  end
57
59
 
metadata CHANGED
@@ -1,209 +1,156 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: factory_girl
3
- version: !ruby/object:Gem::Version
4
- hash: 19
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.6.3
5
5
  prerelease:
6
- segments:
7
- - 2
8
- - 6
9
- - 2
10
- version: 2.6.2
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Joe Ferris
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-03-09 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-03-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: activesupport
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70304756543100 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 17
29
- segments:
30
- - 2
31
- - 3
32
- - 9
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
33
21
  version: 2.3.9
34
22
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: rspec
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70304756543100
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &70304756359060 !ruby/object:Gem::Requirement
40
28
  none: false
41
- requirements:
29
+ requirements:
42
30
  - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 3
45
- segments:
46
- - 2
47
- - 0
48
- version: "2.0"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
49
33
  type: :development
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: cucumber
53
34
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70304756359060
36
+ - !ruby/object:Gem::Dependency
37
+ name: cucumber
38
+ requirement: &70304756358440 !ruby/object:Gem::Requirement
55
39
  none: false
56
- requirements:
40
+ requirements:
57
41
  - - ~>
58
- - !ruby/object:Gem::Version
59
- hash: 23
60
- segments:
61
- - 1
62
- - 0
63
- - 0
42
+ - !ruby/object:Gem::Version
64
43
  version: 1.0.0
65
44
  type: :development
66
- version_requirements: *id003
67
- - !ruby/object:Gem::Dependency
68
- name: timecop
69
45
  prerelease: false
70
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *70304756358440
47
+ - !ruby/object:Gem::Dependency
48
+ name: timecop
49
+ requirement: &70304756357920 !ruby/object:Gem::Requirement
71
50
  none: false
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- hash: 3
76
- segments:
77
- - 0
78
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
79
55
  type: :development
80
- version_requirements: *id004
81
- - !ruby/object:Gem::Dependency
82
- name: rcov
83
56
  prerelease: false
84
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *70304756357920
58
+ - !ruby/object:Gem::Dependency
59
+ name: rcov
60
+ requirement: &70304756356480 !ruby/object:Gem::Requirement
85
61
  none: false
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- hash: 3
90
- segments:
91
- - 0
92
- version: "0"
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
93
66
  type: :development
94
- version_requirements: *id005
95
- - !ruby/object:Gem::Dependency
96
- name: aruba
97
67
  prerelease: false
98
- requirement: &id006 !ruby/object:Gem::Requirement
68
+ version_requirements: *70304756356480
69
+ - !ruby/object:Gem::Dependency
70
+ name: aruba
71
+ requirement: &70304756355320 !ruby/object:Gem::Requirement
99
72
  none: false
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- hash: 3
104
- segments:
105
- - 0
106
- version: "0"
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
107
77
  type: :development
108
- version_requirements: *id006
109
- - !ruby/object:Gem::Dependency
110
- name: mocha
111
78
  prerelease: false
112
- requirement: &id007 !ruby/object:Gem::Requirement
79
+ version_requirements: *70304756355320
80
+ - !ruby/object:Gem::Dependency
81
+ name: mocha
82
+ requirement: &70304756353280 !ruby/object:Gem::Requirement
113
83
  none: false
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- hash: 3
118
- segments:
119
- - 0
120
- version: "0"
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
121
88
  type: :development
122
- version_requirements: *id007
123
- - !ruby/object:Gem::Dependency
124
- name: bourne
125
89
  prerelease: false
126
- requirement: &id008 !ruby/object:Gem::Requirement
90
+ version_requirements: *70304756353280
91
+ - !ruby/object:Gem::Dependency
92
+ name: bourne
93
+ requirement: &70304756351660 !ruby/object:Gem::Requirement
127
94
  none: false
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- hash: 3
132
- segments:
133
- - 0
134
- version: "0"
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
135
99
  type: :development
136
- version_requirements: *id008
137
- - !ruby/object:Gem::Dependency
138
- name: appraisal
139
100
  prerelease: false
140
- requirement: &id009 !ruby/object:Gem::Requirement
101
+ version_requirements: *70304756351660
102
+ - !ruby/object:Gem::Dependency
103
+ name: appraisal
104
+ requirement: &70304756397340 !ruby/object:Gem::Requirement
141
105
  none: false
142
- requirements:
106
+ requirements:
143
107
  - - ~>
144
- - !ruby/object:Gem::Version
145
- hash: 3
146
- segments:
147
- - 0
148
- - 3
149
- - 8
108
+ - !ruby/object:Gem::Version
150
109
  version: 0.3.8
151
110
  type: :development
152
- version_requirements: *id009
153
- - !ruby/object:Gem::Dependency
154
- name: sqlite3-ruby
155
111
  prerelease: false
156
- requirement: &id010 !ruby/object:Gem::Requirement
112
+ version_requirements: *70304756397340
113
+ - !ruby/object:Gem::Dependency
114
+ name: sqlite3-ruby
115
+ requirement: &70304756396380 !ruby/object:Gem::Requirement
157
116
  none: false
158
- requirements:
159
- - - ">="
160
- - !ruby/object:Gem::Version
161
- hash: 3
162
- segments:
163
- - 0
164
- version: "0"
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
165
121
  type: :development
166
- version_requirements: *id010
167
- - !ruby/object:Gem::Dependency
168
- name: yard
169
122
  prerelease: false
170
- requirement: &id011 !ruby/object:Gem::Requirement
123
+ version_requirements: *70304756396380
124
+ - !ruby/object:Gem::Dependency
125
+ name: yard
126
+ requirement: &70304756394680 !ruby/object:Gem::Requirement
171
127
  none: false
172
- requirements:
173
- - - ">="
174
- - !ruby/object:Gem::Version
175
- hash: 3
176
- segments:
177
- - 0
178
- version: "0"
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
179
132
  type: :development
180
- version_requirements: *id011
181
- - !ruby/object:Gem::Dependency
182
- name: bluecloth
183
133
  prerelease: false
184
- requirement: &id012 !ruby/object:Gem::Requirement
134
+ version_requirements: *70304756394680
135
+ - !ruby/object:Gem::Dependency
136
+ name: bluecloth
137
+ requirement: &70304756393520 !ruby/object:Gem::Requirement
185
138
  none: false
186
- requirements:
187
- - - ">="
188
- - !ruby/object:Gem::Version
189
- hash: 3
190
- segments:
191
- - 0
192
- version: "0"
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
193
143
  type: :development
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.
144
+ prerelease: false
145
+ version_requirements: *70304756393520
146
+ description: ! "factory_girl provides a framework and DSL for defining and\n using
147
+ factories - less error-prone, more explicit, and\n all-around
148
+ easier to work with than fixtures."
199
149
  email: jferris@thoughtbot.com
200
150
  executables: []
201
-
202
151
  extensions: []
203
-
204
152
  extra_rdoc_files: []
205
-
206
- files:
153
+ files:
207
154
  - .autotest
208
155
  - .gitignore
209
156
  - .rspec
@@ -348,40 +295,30 @@ files:
348
295
  - spec/support/shared_examples/strategy.rb
349
296
  homepage: https://github.com/thoughtbot/factory_girl
350
297
  licenses: []
351
-
352
298
  post_install_message:
353
299
  rdoc_options: []
354
-
355
- require_paths:
300
+ require_paths:
356
301
  - lib
357
- required_ruby_version: !ruby/object:Gem::Requirement
302
+ required_ruby_version: !ruby/object:Gem::Requirement
358
303
  none: false
359
- requirements:
360
- - - ">="
361
- - !ruby/object:Gem::Version
362
- hash: 57
363
- segments:
364
- - 1
365
- - 8
366
- - 7
304
+ requirements:
305
+ - - ! '>='
306
+ - !ruby/object:Gem::Version
367
307
  version: 1.8.7
368
- required_rubygems_version: !ruby/object:Gem::Requirement
308
+ required_rubygems_version: !ruby/object:Gem::Requirement
369
309
  none: false
370
- requirements:
371
- - - ">="
372
- - !ruby/object:Gem::Version
373
- hash: 3
374
- segments:
375
- - 0
376
- version: "0"
310
+ requirements:
311
+ - - ! '>='
312
+ - !ruby/object:Gem::Version
313
+ version: '0'
377
314
  requirements: []
378
-
379
315
  rubyforge_project:
380
316
  rubygems_version: 1.8.16
381
317
  signing_key:
382
318
  specification_version: 3
383
- summary: factory_girl provides a framework and DSL for defining and using model instance factories.
384
- test_files:
319
+ summary: factory_girl provides a framework and DSL for defining and using model instance
320
+ factories.
321
+ test_files:
385
322
  - Appraisals
386
323
  - features/factory_girl_steps.feature
387
324
  - features/find_definitions.feature