factory_bot 5.0.0 → 5.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,102 @@
1
+ module FactoryBot
2
+ # @api private
3
+ module Internal
4
+ DEFAULT_STRATEGIES = {
5
+ build: FactoryBot::Strategy::Build,
6
+ create: FactoryBot::Strategy::Create,
7
+ attributes_for: FactoryBot::Strategy::AttributesFor,
8
+ build_stubbed: FactoryBot::Strategy::Stub,
9
+ null: FactoryBot::Strategy::Null,
10
+ }.freeze
11
+
12
+ DEFAULT_CALLBACKS = [
13
+ :after_create, :after_build, :after_stub, :after_create
14
+ ].freeze
15
+
16
+ class << self
17
+ delegate :callback_names,
18
+ :factories,
19
+ :inline_sequences,
20
+ :sequences,
21
+ :strategies,
22
+ :traits,
23
+ to: :configuration
24
+
25
+ def configuration
26
+ @configuration ||= Configuration.new
27
+ end
28
+
29
+ def reset_configuration
30
+ @configuration = nil
31
+ end
32
+
33
+ def register_inline_sequence(sequence)
34
+ inline_sequences.push(sequence)
35
+ end
36
+
37
+ def rewind_inline_sequences
38
+ inline_sequences.each(&:rewind)
39
+ end
40
+
41
+ def register_trait(trait)
42
+ trait.names.each do |name|
43
+ traits.register(name, trait)
44
+ end
45
+ trait
46
+ end
47
+
48
+ def trait_by_name(name)
49
+ traits.find(name)
50
+ end
51
+
52
+ def register_sequence(sequence)
53
+ sequence.names.each do |name|
54
+ sequences.register(name, sequence)
55
+ end
56
+ sequence
57
+ end
58
+
59
+ def sequence_by_name(name)
60
+ sequences.find(name)
61
+ end
62
+
63
+ def rewind_sequences
64
+ sequences.each(&:rewind)
65
+ rewind_inline_sequences
66
+ end
67
+
68
+ def register_factory(factory)
69
+ factory.names.each do |name|
70
+ factories.register(name, factory)
71
+ end
72
+ factory
73
+ end
74
+
75
+ def factory_by_name(name)
76
+ factories.find(name)
77
+ end
78
+
79
+ def register_strategy(strategy_name, strategy_class)
80
+ strategies.register(strategy_name, strategy_class)
81
+ StrategySyntaxMethodRegistrar.new(strategy_name).define_strategy_methods
82
+ end
83
+
84
+ def strategy_by_name(name)
85
+ strategies.find(name)
86
+ end
87
+
88
+ def register_default_strategies
89
+ DEFAULT_STRATEGIES.each { |name, klass| register_strategy(name, klass) }
90
+ end
91
+
92
+ def register_default_callbacks
93
+ DEFAULT_CALLBACKS.each(&method(:register_callback))
94
+ end
95
+
96
+ def register_callback(name)
97
+ name = name.to_sym
98
+ callback_names << name
99
+ end
100
+ end
101
+ end
102
+ end
@@ -72,8 +72,8 @@ module FactoryBot
72
72
  result = []
73
73
  begin
74
74
  FactoryBot.public_send(factory_strategy, factory.name)
75
- rescue StandardError => error
76
- result |= [FactoryError.new(error, factory)]
75
+ rescue StandardError => e
76
+ result |= [FactoryError.new(e, factory)]
77
77
  end
78
78
  result
79
79
  end
@@ -83,9 +83,9 @@ module FactoryBot
83
83
  factory.definition.defined_traits.map(&:name).each do |trait_name|
84
84
  begin
85
85
  FactoryBot.public_send(factory_strategy, factory.name, trait_name)
86
- rescue StandardError => error
86
+ rescue StandardError => e
87
87
  result |=
88
- [FactoryTraitError.new(error, factory, trait_name)]
88
+ [FactoryTraitError.new(e, factory, trait_name)]
89
89
  end
90
90
  end
91
91
  result
@@ -8,7 +8,7 @@ module FactoryBot
8
8
  end
9
9
 
10
10
  delegate :defined_traits, :callbacks, :attributes, :constructor,
11
- :to_create, to: :definition
11
+ :to_create, to: :definition
12
12
 
13
13
  def compile; end
14
14
 
@@ -21,8 +21,8 @@ module FactoryBot
21
21
 
22
22
  def find(name)
23
23
  @items.fetch(name)
24
- rescue KeyError => key_error
25
- raise key_error_with_custom_message(key_error)
24
+ rescue KeyError => e
25
+ raise key_error_with_custom_message(e)
26
26
  end
27
27
 
28
28
  alias :[] :find
@@ -1,8 +1,8 @@
1
1
  module FactoryBot
2
2
  def self.reload
3
- reset_configuration
4
- register_default_strategies
5
- register_default_callbacks
3
+ Internal.reset_configuration
4
+ Internal.register_default_strategies
5
+ Internal.register_default_callbacks
6
6
  find_definitions
7
7
  end
8
8
  end
@@ -44,15 +44,17 @@ module FactoryBot
44
44
  end
45
45
 
46
46
  def stub_database_interaction_on_result(result_instance)
47
- result_instance.id ||= next_id
47
+ if has_settable_id?(result_instance)
48
+ result_instance.id ||= next_id
49
+ end
48
50
 
49
51
  result_instance.instance_eval do
50
52
  def persisted?
51
- !new_record?
53
+ true
52
54
  end
53
55
 
54
56
  def new_record?
55
- id.nil?
57
+ false
56
58
  end
57
59
 
58
60
  def destroyed?
@@ -68,6 +70,11 @@ module FactoryBot
68
70
  end
69
71
  end
70
72
 
73
+ def has_settable_id?(result_instance)
74
+ !result_instance.class.respond_to?(:primary_key) ||
75
+ result_instance.class.primary_key
76
+ end
77
+
71
78
  def clear_changes_information(result_instance)
72
79
  if result_instance.respond_to?(:clear_changes_information)
73
80
  result_instance.clear_changes_information
@@ -20,7 +20,7 @@ module FactoryBot
20
20
  end
21
21
 
22
22
  def strategy_name_to_object
23
- FactoryBot.strategy_by_name(@name_or_object)
23
+ FactoryBot::Internal.strategy_by_name(@name_or_object)
24
24
  end
25
25
  end
26
26
  end
@@ -17,7 +17,7 @@ module FactoryBot
17
17
  proxy = FactoryBot::DefinitionProxy.new(factory.definition)
18
18
  proxy.instance_eval(&block) if block_given?
19
19
 
20
- FactoryBot.register_factory(factory)
20
+ Internal.register_factory(factory)
21
21
 
22
22
  proxy.child_factories.each do |(child_name, child_options, child_block)|
23
23
  parent_factory = child_options.delete(:parent) || name
@@ -26,11 +26,11 @@ module FactoryBot
26
26
  end
27
27
 
28
28
  def sequence(name, *args, &block)
29
- FactoryBot.register_sequence(Sequence.new(name, *args, &block))
29
+ Internal.register_sequence(Sequence.new(name, *args, &block))
30
30
  end
31
31
 
32
32
  def trait(name, &block)
33
- FactoryBot.register_trait(Trait.new(name, &block))
33
+ Internal.register_trait(Trait.new(name, &block))
34
34
  end
35
35
 
36
36
  def to_create(&block)
@@ -54,13 +54,13 @@ module FactoryBot
54
54
  private
55
55
 
56
56
  def configuration
57
- FactoryBot.configuration
57
+ Internal.configuration
58
58
  end
59
59
  end
60
60
 
61
61
  class ModifyDSL
62
62
  def factory(name, _options = {}, &block)
63
- factory = FactoryBot.factory_by_name(name)
63
+ factory = Internal.factory_by_name(name)
64
64
  proxy = FactoryBot::DefinitionProxy.new(factory.definition.overridable)
65
65
  proxy.instance_eval(&block)
66
66
  end
@@ -30,7 +30,7 @@ module FactoryBot
30
30
  ## # factory with traits and attribute override
31
31
  ## build_stubbed_list(:user, 15, :admin, :male, name: "John Doe")
32
32
  module Methods
33
- # @!parse FactoryBot.register_default_strategies
33
+ # @!parse FactoryBot::Internal.register_default_strategies
34
34
  # @!method build(name, *traits_and_overrides, &block)
35
35
  # (see #strategy_method)
36
36
  # Builds a registered factory by name.
@@ -111,7 +111,7 @@ module FactoryBot
111
111
  # Returns:
112
112
  # The next value in the sequence. (Object)
113
113
  def generate(name)
114
- FactoryBot.sequence_by_name(name).next
114
+ Internal.sequence_by_name(name).next
115
115
  end
116
116
 
117
117
  # Generates and returns the list of values in a sequence.
@@ -126,7 +126,7 @@ module FactoryBot
126
126
  # The next value in the sequence. (Object)
127
127
  def generate_list(name, count)
128
128
  (1..count).map do
129
- FactoryBot.sequence_by_name(name).next
129
+ Internal.sequence_by_name(name).next
130
130
  end
131
131
  end
132
132
  end
@@ -4,12 +4,14 @@ module FactoryBot
4
4
  attr_reader :name, :definition
5
5
 
6
6
  def initialize(name, &block)
7
- @name = name.to_sym
7
+ @name = name.to_s
8
8
  @block = block
9
9
  @definition = Definition.new(@name)
10
-
11
10
  proxy = FactoryBot::DefinitionProxy.new(@definition)
12
- proxy.instance_eval(&@block) if block_given?
11
+
12
+ if block_given?
13
+ proxy.instance_eval(&@block)
14
+ end
13
15
  end
14
16
 
15
17
  delegate :add_callback, :declare_attribute, :to_create, :define_trait, :constructor,
@@ -1,3 +1,3 @@
1
1
  module FactoryBot
2
- VERSION = "5.0.0".freeze
2
+ VERSION = "5.1.2".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factory_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Clayton
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-02-01 00:00:00.000000000 Z
12
+ date: 2020-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -127,18 +127,18 @@ dependencies:
127
127
  name: rubocop
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - '='
130
+ - - ">="
131
131
  - !ruby/object:Gem::Version
132
- version: '0.54'
132
+ version: '0'
133
133
  type: :development
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - '='
137
+ - - ">="
138
138
  - !ruby/object:Gem::Version
139
- version: '0.54'
139
+ version: '0'
140
140
  - !ruby/object:Gem::Dependency
141
- name: simplecov
141
+ name: rubocop-performance
142
142
  requirement: !ruby/object:Gem::Requirement
143
143
  requirements:
144
144
  - - ">="
@@ -152,7 +152,7 @@ dependencies:
152
152
  - !ruby/object:Gem::Version
153
153
  version: '0'
154
154
  - !ruby/object:Gem::Dependency
155
- name: sqlite3
155
+ name: rubocop-rails
156
156
  requirement: !ruby/object:Gem::Requirement
157
157
  requirements:
158
158
  - - ">="
@@ -166,7 +166,7 @@ dependencies:
166
166
  - !ruby/object:Gem::Version
167
167
  version: '0'
168
168
  - !ruby/object:Gem::Dependency
169
- name: timecop
169
+ name: simplecov
170
170
  requirement: !ruby/object:Gem::Requirement
171
171
  requirements:
172
172
  - - ">="
@@ -207,7 +207,7 @@ files:
207
207
  - GETTING_STARTED.md
208
208
  - LICENSE
209
209
  - NAME.md
210
- - NEWS
210
+ - NEWS.md
211
211
  - README.md
212
212
  - lib/factory_bot.rb
213
213
  - lib/factory_bot/aliases.rb
@@ -240,6 +240,7 @@ files:
240
240
  - lib/factory_bot/factory.rb
241
241
  - lib/factory_bot/factory_runner.rb
242
242
  - lib/factory_bot/find_definitions.rb
243
+ - lib/factory_bot/internal.rb
243
244
  - lib/factory_bot/linter.rb
244
245
  - lib/factory_bot/null_factory.rb
245
246
  - lib/factory_bot/null_object.rb
@@ -278,7 +279,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
278
279
  - !ruby/object:Gem::Version
279
280
  version: '0'
280
281
  requirements: []
281
- rubygems_version: 3.0.1
282
+ rubygems_version: 3.1.2
282
283
  signing_key:
283
284
  specification_version: 4
284
285
  summary: factory_bot provides a framework and DSL for defining and using model instance
data/NEWS DELETED
@@ -1,323 +0,0 @@
1
- 5.0.0
2
- Added: Verbose option to include full backtraces in the linting output
3
- Changed: use_parent_strategy now defaults to true, so by default the
4
- build strategy will build, rather than create associations
5
- Changed: Passing a block when defining associations now raises an error
6
- Bugfix: use_parent_strategy is no longer reset by FactoryBot.reload
7
- Bugfix: rewind_sequences will now rewind local sequences along with the global ones
8
- Bugfix: the build_stubbed strategy now sets timestamps without changing the
9
- the original behavior of the timestamp methods
10
- Bugfix: avoid a stack error when referring to an "attributes" attribute in initialize_with
11
- Removed: support for EOL versions of Ruby and Rails
12
- Removed: static attributes (use dynamic attributes with a block instead)
13
- Removed: looking up factories by class
14
- Removed: ignore method (use transient instead)
15
- Removed: duplicate_attribute_assignment_from_initialize_with configuration option
16
- Deprecated: allow_class_lookup configuration option
17
-
18
- 4.11.1 (September 7, 2018)
19
- Documentation: Include .yardopts in the gem to fix broken RubyDoc links
20
-
21
- 4.11.0 (August, 15, 2018)
22
- Bugfix: Do not raise error for valid build_stubbed methods: decrement, increment, and toggle
23
- Bugfix: Do not add timestamps with build_stubbed for objects that shouldn't have timestamps
24
- Deprecate static attributes
25
-
26
- 4.10.0 (May 25, 2018)
27
- Allow sequences to be rewound
28
-
29
- 4.9.0 (skipped - FactoryGirl only release)
30
-
31
- 4.8.2 (October 20, 2017)
32
- Rename factory_girl to factory_bot
33
-
34
- 4.8.1 (September 28, 2017)
35
- Explicitly define `#destroyed?` within the `Stub` strategy to return `nil` instead of raising
36
- Update various dependencies
37
- Update internal test suite to use RSpec's mocking/stubbing instead of mocha
38
-
39
- 4.8.0 (December 16, 2016)
40
- Improve documentation
41
- Add `FactoryGirl.generate_list` to be consistent with `build_list`/`create_list` and friends
42
- Add `FactoryGirl.use_parent_strategy` configuration to allow associations to leverage parent build strategy
43
-
44
- 4.7.0 (April 1, 2016)
45
- Improve documentation
46
- Improve instrumentation payload to include traits, overrides, and the factory itself
47
- Allow linting of traits
48
- Deprecate factory lookup by class name in preparation for 5.0
49
- Improve internal performance by using flat_map instead of map and compact
50
- Improve handling of dirty attributes after building a stubbed object
51
- Reduce warnings from redefining methods
52
-
53
- 4.6.0 (skipped)
54
-
55
- 4.5.0 (October 17, 2014)
56
- Improve FactoryGirl.lint by including exception and message in output
57
- Allow selective linting
58
- Use more explicit #public_send when doing attribute assignment
59
- Improve documentation around FactoryGirl.lint and initialize_with
60
- Deprecate #ignore in favor of #transient
61
-
62
- 4.4.0 (February 10, 2014)
63
- Add FactoryGirl.lint
64
- Fix memory leak in duplicate traits
65
- Update documentation
66
-
67
- 4.3.0 (November 3, 2013)
68
- Start testing against Rails 4.0 and Ruby 2.0.0
69
- Stop testing against Rails 3.0 and Ruby 1.9.2
70
- Add *_pair methods to only build two objects
71
- Raise if a method is defined with a FactoryGirl block (factory or trait)
72
- Allow use of Symbol#to_proc in callbacks
73
- Add global callbacks
74
- Improve GETTING_STARTED and README
75
-
76
- 4.2.0 (January 18, 2013)
77
- Improve documentation
78
- Allow *_list syntax methods to accept a block
79
- Update gem dependencies
80
- Allow setting id for objects created with `build_stubbed`
81
- Fix Stub strategy to mimic ActiveRecord regarding `created_at`
82
- Evaluate sequences within the context of an Evaluator
83
- Fix Mocha deprecation warning
84
- Fix some warnings when running RUBYOPT=-w rake
85
- Convert test suite to RSpec's "expect" syntax
86
-
87
- 4.1.0 (September 11, 2012)
88
- Allow multiple callbacks to bind to the same block
89
- Fix documentation surrounding the stub strategy
90
-
91
- 4.0.0 (August 3, 2012)
92
- Remove deprecated cucumber_steps
93
- Remove deprecated alternate syntaxes
94
- Deprecate duplicate_attribute_assignment_from_initialize_with, which is now unused
95
- as attributes assigned within initialize_with are not subsequently assigned
96
-
97
- 3.6.1 (August 2, 2012)
98
- Update README to include info about running with JRuby
99
- Update dependencies on RSpec and tiny versions of Rails in Appraisal
100
- Improve flexibility of using traits with associations and add documentation
101
- Stub update_column to raise to mirror ActiveRecord's change from update_attribute
102
-
103
- 3.6.0 (July 27, 2012)
104
- Code/spec cleanup
105
- Allow factories with traits to be used in associations
106
- Refactor Factory to use DefinitionHierarchy to handle managing callbacks,
107
- custom constructor, and custom to_create
108
- Add memoization to speed up factories providing attribute overrides
109
- Add initial support of JRuby when running in 1.9 mode
110
- Improve docs on what happens when including FactoryGirl::Syntax::Methods
111
-
112
- 3.5.0 (June 22, 2012)
113
- Allow created_at to be set when using build_stubbed
114
- Deprecate FactoryGirl step definitions
115
-
116
- 3.4.2 (June 19, 2012)
117
- Fix bug in traits with callbacks called implicitly in factories whose
118
- callbacks trigger multiple times
119
-
120
- 3.4.1 (June 18, 2012)
121
- Fix traits so they can be nested and referred to from other traits
122
-
123
- 3.4.0 (June 11, 2012)
124
- Sequences support Enumerators
125
- Optionally disable duplicate assignment of attributes in initialize_with
126
- Make hash of public attributes available in initialize_with
127
- Support referring to a factory based on class name
128
-
129
- 3.3.0 (May 13, 2012)
130
- Allow to_create, skip_create, and initialize_with to be defined globally
131
- Allow to_create, skip_create, and initialize_with to be defined within traits
132
- Fix deprecation messages for alternate syntaxes (make, generate, etc.)
133
- Improve library documentation
134
- Deprecate after_build, after_create, before_create, after_stub in favor of new callbacks
135
- Introduce new callback syntax: after(:build) {}, after(:custom) {}, or callback(:different) {}
136
- This allows for declaring any callback, usable with custom strategies
137
- Add attributes_for_list and build_stubbed_list with the StrategySyntaxMethodRegistrar
138
- Allow use of syntax methods (build, create, generate, etc) implicitly in callbacks
139
- Internal refactoring of a handful of components
140
-
141
- 3.2.0 (April 24, 2012)
142
- Use AS::Notifications for pub/sub to track running factories
143
- Call new within initialize_with implicitly on the build class
144
- Skip to_create with skip_create
145
- Allow registration of custom strategies
146
- Deprecate alternate syntaxes
147
- Implicitly call factory_bot's syntax methods from dynamic attributes
148
-
149
- 3.1.0 (April 6, 2012)
150
- Sequences support aliases, which reference the same block
151
- Update documentation
152
- Add before_create callback
153
- Support use of #attribute_names method to determine available attributes for steps
154
- Use ActiveSupport::Deprecation for all deprecations
155
-
156
- 3.0.0 (March 23, 2012)
157
- Deprecate the vintage syntax
158
- Remove Rails 2.x support
159
- Remove Ruby 1.8 support
160
- Remove deprecated features, including default_strategy, factory_name,
161
- :method for defining default strategy, ignore on individual attributes, and
162
- interacting with Factory the way you would FactoryGirl
163
-
164
- 2.6.4 (March 16, 2012)
165
- Do not ignore names of transient attributes
166
- Ensure attributes set on instance are calculated uniquely
167
-
168
- 2.6.3 (March 9, 2012)
169
- Fix issue with traits not being present the first time a factory is accessed
170
- Update available Cucumber step definitions to not require a trailing colon
171
- when building a table of attributes to instantiate records with
172
-
173
- 2.6.2 (March 9, 2012)
174
- Allow factories to use all their ancestors' traits
175
- Ignore bin dir generated by bundler
176
- Namespace ::Factory as top-level to fix vintage syntax issue with
177
- Ruby 1.9.2-p3p18
178
-
179
- 2.6.1 (March 2, 2012)
180
- Use FactoryGirl.reload in specs
181
- Clean up running named factories with a particular strategy with
182
- FactoryGirl::FactoryRunner
183
-
184
- 2.6.0 (February 17, 2012)
185
- Improve documentation of has_many associations in the GETTING_STARTED
186
- document
187
- Deprecate :method in favor of :strategy when overriding an association's
188
- build strategy
189
-
190
- 2.5.2 (February 10, 2012)
191
- Fix step definitions to use associations defined in parent factories
192
- Add inline trait support to (build|create)_list
193
- Update ActiveSupport dependency to >= 2.3.9, which introduced
194
- class_attribute
195
-
196
- 2.5.1 (February 3, 2012)
197
- Fix attribute evaluation when the attribute isn't defined in the factory but
198
- is a private method on Object
199
- Update rubygems on Travis before running tests
200
- Fix spec name
201
- Update GETTING_STARTED with correct usage of build_stubbed
202
- Update README with more info on initialize_with
203
- Honor :parent on factory over block nesting
204
-
205
- 2.5.0 (January 20, 2012)
206
- Revert 'Deprecate build_stubbed and attributes_for'
207
- Implement initialize_with to allow overriding object instantiation
208
- Ensure FG runs against Rails 3.2.0
209
-
210
- 2.4.2 (January 18, 2012)
211
- Fix inline traits' interaction with defaults on the factory
212
-
213
- 2.4.1 (January 17, 2012)
214
- Deprecate build_stubbed and attributes_for
215
- Fix inline traits
216
-
217
- 2.4.0 (January 13, 2012)
218
- Refactor internals of FactoryGirl to use anonymous class on which attributes
219
- get defined
220
- Explicitly require Ruby 1.8.7 or higher in gemspec
221
- Fix documentation
222
- Add Gemnasium status to documentation
223
- Supplying a Class to a factory that overrides to_s no longer results in
224
- getting the wrong Class constructed
225
- Be more agnostic about ORMs when using columns in FactoryGirl step
226
- definitions
227
- Test against Active Record 3.2.0.rc2
228
- Update GETTING_STARTED to use Ruby syntax highlighting
229
-
230
- 2.3.2 (November 26, 2011)
231
- Move logic of where instance.save! is set to Definition
232
- Fix method name from aliases_for? to alias_for?
233
- Refactor internal attribute handling to use an anonymous class instead of
234
- faking Ruby's variable resolution. This allows for more sane usage of
235
- attributes without having to manage sorting priority because attributes
236
- can turn themselves into procs, which are used with define_method on a
237
- class so attributes work correctly all the time.
238
-
239
- 2.3.1 (November 23, 2011)
240
- Remove internally-used associate method from all the FactoryGirl::Proxy subclasses
241
- Move around requiring of files
242
- Consolidate errors into factory_bot.rb
243
- Refactor AttributeList to deal with priority only when iterating over
244
- attributes
245
- Refactor internals of some of the Proxy subclasses
246
- Ensure callbacks on traits are executed in the correct order
247
-
248
- 2.3.0 (November 18, 2011)
249
- Registries are named, resulting in better messages when factories, traits,
250
- or sequences cannot be found
251
- Fix incorrect tests
252
- Internals refactoring introducing FactoryGirl::NullFactory,
253
- FactoryGirl::Definition, and FactoryGirl::DeclarationList
254
- Use ActiveSupport for Hash#except and its delegation capabilities
255
- Fix usage of callbacks when added via implicit traits
256
- Use Bundler tasks and clean up dependencies
257
- Fix failing spec for big letters in factory name passed as symbol
258
- Add ability for traits to be added dynamically when creating an instance via
259
- build, create, build_stubbed, or attributes_for
260
-
261
- 2.2.0 (October 14, 2011)
262
- Clean up RSpec suite to not use 'should'
263
- Use create_list in step definitions
264
- Syntax methods that deal with ORM interaction (attributes_for, build, build_stubbed,
265
- and create) now accept a block that yields the result. This results in a
266
- more convenient way to interact with the result than using Object.tap.
267
- Standardize deprecation warnings
268
- Update transient attribute syntax to use blocks instead of calling ignore on
269
- each attribute declaration
270
- Parents can be defined after children because factories are evaluated when
271
- they're used; this means breaking up factories across multiple files will
272
- behave as expected
273
- Large internal refactoring, including changing access modifiers for a
274
- handful of methods for a more clearly defined API
275
-
276
- 2.1.2 (September 23, 2011)
277
- Bugfix: Vintage syntax fixed after bug introduced in 2.1.1
278
- Introduce dependency on activesupport to remove code from Factory class
279
-
280
- 2.1.1 (September 23, 2011) (yanked)
281
- Bugfix: Parent object callbacks are run before child object callbacks
282
- Declarations: allow overriding/modification of individual traits in child factories
283
- Callbacks refactored to not be attributes
284
- Updating documentation for formatting and clarity (incl. new specificity for cucumber)
285
-
286
- 2.1.0 (September 02, 2011)
287
- Bugfix: created_at now defined for stubbed models
288
- Gemspec updated for use with Rails 3.1
289
- Factories can now be modified post-definition (useful for overriding defaults from gems/plugins)
290
- All factories can now be reloaded with Factory.reload
291
- Add :method => build to factory associations to prevent saving of associated objects
292
- Factories defined in {Rails.root}/factories are now loaded by default
293
- Various documentation updates
294
-
295
- 1.1.4 (November 28, 2008)
296
- Factory.build now uses Factory.create for associations of the built object
297
- Factory definitions are now detected in subdirectories, such as
298
- factories/person_factory.rb (thanks to Josh Nichols)
299
- Factory definitions are now loaded after the environment in a Rails project
300
- (fixes some issues with dependencies being loaded too early) (thanks to
301
- Josh Nichols)
302
- Factory names ending in 's' no longer cause problems (thanks to Alex Sharp
303
- and Josh Owens)
304
-
305
- 1.1.3 (September 12, 2008)
306
- Automatically pull in definitions from factories.rb, test/factories.rb, or
307
- spec/factories.rb
308
- 1.1.2 (July 30, 2008)
309
- Improved error handling for invalid and undefined factories/attributes
310
- Improved handling of strings vs symbols vs classes
311
- Added a prettier syntax for handling associations
312
- Updated documentation and fixed compatibility with Rails 2.1
313
-
314
- 1.1.1 (June 23, 2008)
315
- The attribute "name" no longer requires using #add_attribute
316
-
317
- 1.1.0 (June 03, 2008)
318
- Added support for dependent attributes
319
- Fixed the attributes_for build strategy to not build associations
320
- Added support for sequences
321
-
322
- 1.0.0 (May 31, 2008)
323
- First version