factory_bot 6.2.0 → 6.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a928c94babd835a0756175aa3d7a1f03d4dae15b0782818a8c9688489f6e18d3
4
- data.tar.gz: e2875eca60137531b83267dcdfd87ba1329ed8a52e460a0e609fa5fb04f39244
3
+ metadata.gz: be53175a79d79c70dbaae41a86638d7013b968cecf59aaaa1cedc813ef4e4bc6
4
+ data.tar.gz: 4d3312a1ec50b608daa376d41e176ee713fba29ee80c1ce0acd0a646ce4a9956
5
5
  SHA512:
6
- metadata.gz: bf8f7006ff4e0f34533259c6e747bb61cd8ebcd6d68b7a9076b811bf4b152662997f18ad467953c07f3a0c7c10585b48b4f0489ce6aa1a16b42ad02641e7169b
7
- data.tar.gz: a80c3ed49517c2cee0dc7bdafc9dd3459d7fcd83443873e2a8c72db8a3c96b6d902975c8a586ecbfb1cd6b8dab9513a4bdfaa22f84c297f81b2736a8f4317e8d
6
+ metadata.gz: 6077f43c7fc1486a2b1ac6d009f3c95e5c736afbe76c62d1818eb8ad26e77aa9f249b74dd1715b11da3bc989abee47a9a28f4da250e8fe10b036aa4121afc786
7
+ data.tar.gz: c4de0a35286906b04e4d4d0e489e437135a1553241f80e5338332b90657e253f055084e5c040e4dc6097b79102a5781c5226a89d89c9108edfb97c1b616fdaa0
data/CONTRIBUTING.md CHANGED
@@ -94,12 +94,12 @@ Use [standard] to automatically format your code:
94
94
  bundle exec rake standard:fix
95
95
  ```
96
96
 
97
- [repo]: https://github.com/thoughtbot/factory_bot/tree/master
97
+ [repo]: https://github.com/thoughtbot/factory_bot/tree/main
98
98
  [fork]: https://help.github.com/articles/fork-a-repo/
99
99
  [branch]: https://help.github.com/articles/creating-and-deleting-branches-within-your-repository/
100
100
  [pr]: https://help.github.com/articles/using-pull-requests/
101
101
  [standard]: https://github.com/testdouble/standard
102
102
  [appraisal]: https://github.com/thoughtbot/appraisal
103
- [reproduction script]: https://github.com/thoughtbot/factory_bot/blob/master/.github/REPRODUCTION_SCRIPT.rb
103
+ [reproduction script]: https://github.com/thoughtbot/factory_bot/blob/main/.github/REPRODUCTION_SCRIPT.rb
104
104
 
105
105
  Inspired by https://github.com/middleman/middleman-heroku/blob/master/CONTRIBUTING.md
data/GETTING_STARTED.md CHANGED
@@ -1,3 +1,19 @@
1
+ **Deprecated**
2
+
3
+ See our extensive reference, guides, and cookbook in [the factory_bot book][].
4
+
5
+ For information on integrations with third party libraries, such as RSpec or
6
+ Rails, see [the factory_bot wiki][].
7
+
8
+ We also have [a detailed introductory video][], available for free on Upcase.
9
+
10
+ [a detailed introductory video]: https://upcase.com/videos/factory-bot?utm_source=github&utm_medium=open-source&utm_campaign=factory-girl
11
+ [the factory_bot book]: https://thoughtbot.github.io/factory_bot
12
+ [the factory_bot wiki]: https://github.com/thoughtbot/factory_bot/wiki
13
+
14
+ This document is deprecated and preserved for historical use. It may disappear
15
+ at any time.
16
+
1
17
  Getting Started
2
18
  ===============
3
19
 
@@ -424,7 +440,7 @@ end
424
440
  Method Name / Reserved Word Attributes
425
441
  -------------------------------
426
442
 
427
- If your attributes conflict with existing methods or reserved words (all methods in the [DefinitionProxy](https://github.com/thoughtbot/factory_bot/blob/master/lib/factory_bot/definition_proxy.rb) class) you can define them with `add_attribute`.
443
+ If your attributes conflict with existing methods or reserved words (all methods in the [DefinitionProxy](https://github.com/thoughtbot/factory_bot/blob/main/lib/factory_bot/definition_proxy.rb) class) you can define them with `add_attribute`.
428
444
 
429
445
  ```ruby
430
446
  factory :dna do
@@ -592,7 +608,7 @@ Attribute overrides can be used to link associated objects:
592
608
  ```ruby
593
609
  FactoryBot.define do
594
610
  factory :author do
595
- author_last_name { 'Taylor' }
611
+ name { 'Taylor' }
596
612
  end
597
613
 
598
614
  factory :post do
@@ -1013,6 +1029,15 @@ factory :post do
1013
1029
  end
1014
1030
  ```
1015
1031
 
1032
+ Please note, that the value for the sequence could be any Enumerable instance,
1033
+ as long as it responds to `#next`:
1034
+
1035
+ ```ruby
1036
+ factory :task do
1037
+ sequence :priority, %i[low medium high urgent].cycle
1038
+ end
1039
+ ```
1040
+
1016
1041
  ### Aliases
1017
1042
 
1018
1043
  Sequences can also have aliases. The sequence aliases share the same counter:
@@ -1187,6 +1212,28 @@ factory :user do
1187
1212
  end
1188
1213
  ```
1189
1214
 
1215
+ ### As mixins
1216
+
1217
+ Traits can be defined outside of factories and used as mixins to compose shared attributes
1218
+
1219
+ ```ruby
1220
+ FactoryBot.define do
1221
+ trait :timestamps do
1222
+ created_at { 8.days.ago }
1223
+ updated_at { 4.days.ago }
1224
+ end
1225
+
1226
+ factory :user, traits: [:timestamps] do
1227
+ username { "john_doe" }
1228
+ end
1229
+
1230
+ factory :post do
1231
+ timestamps
1232
+ title { "Traits rock" }
1233
+ end
1234
+ end
1235
+ ```
1236
+
1190
1237
  ### Using traits
1191
1238
 
1192
1239
  Traits can also be passed in as a list of symbols when you construct an instance
@@ -1574,6 +1621,15 @@ twenty_somethings = build_list(:user, 10) do |user, i|
1574
1621
  end
1575
1622
  ```
1576
1623
 
1624
+ `create_list` passes saved instances into the block. If you modify the instance, you must save it again:
1625
+
1626
+ ```ruby
1627
+ twenty_somethings = create_list(:user, 10) do |user, i|
1628
+ user.date_of_birth = (20 + i).years.ago
1629
+ user.save!
1630
+ end
1631
+ ```
1632
+
1577
1633
  `build_stubbed_list` will give you fully stubbed out instances:
1578
1634
 
1579
1635
  ```ruby
@@ -1832,6 +1888,10 @@ class JsonStrategy
1832
1888
  def result(evaluation)
1833
1889
  @strategy.result(evaluation).to_json
1834
1890
  end
1891
+
1892
+ def to_sym
1893
+ :json
1894
+ end
1835
1895
  end
1836
1896
  ```
1837
1897
 
@@ -1872,6 +1932,10 @@ class JsonStrategy
1872
1932
  evaluation.notify(:make_json_awesome, json)
1873
1933
  end
1874
1934
  end
1935
+
1936
+ def to_sym
1937
+ :json
1938
+ end
1875
1939
  end
1876
1940
 
1877
1941
  FactoryBot.register_strategy(:json, JsonStrategy)
@@ -1926,7 +1990,7 @@ ActiveSupport Instrumentation
1926
1990
 
1927
1991
  In order to track what factories are created (and with what build strategy),
1928
1992
  `ActiveSupport::Notifications` are included to provide a way to subscribe to
1929
- factories being run. One example would be to track factories based on a
1993
+ factories being compiled and run. One example would be to track factories based on a
1930
1994
  threshold of execution time.
1931
1995
 
1932
1996
  ```ruby
@@ -1960,6 +2024,29 @@ config.after(:suite) do
1960
2024
  end
1961
2025
  ```
1962
2026
 
2027
+ Another example could involve tracking the attributes and traits that factories are compiled with. If you're using RSpec, you could add `before(:suite)` and `after(:suite)` blocks that subscribe to `factory_bot.compile_factory` notifications:
2028
+
2029
+ ```ruby
2030
+ factory_bot_results = {}
2031
+ config.before(:suite) do
2032
+ ActiveSupport::Notifications.subscribe("factory_bot.compile_factory") do |name, start, finish, id, payload|
2033
+ factory_name = payload[:name]
2034
+ factory_class = payload[:class]
2035
+ attributes = payload[:attributes]
2036
+ traits = payload[:traits]
2037
+ factory_bot_results[factory_class] ||= {}
2038
+ factory_bot_results[factory_class][factory_name] = {
2039
+ attributes: attributes.map(&:name)
2040
+ traits: traits.map(&:name)
2041
+ }
2042
+ end
2043
+ end
2044
+
2045
+ config.after(:suite) do
2046
+ puts factory_bot_results
2047
+ end
2048
+ ```
2049
+
1963
2050
  Rails Preloaders and RSpec
1964
2051
  --------------------------
1965
2052
 
data/NEWS.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # News
2
2
 
3
+ ## 6.3.0 (September 1, 2023)
4
+
5
+ * Fix: link to changelog for RubyGems (Berkan Ünal).
6
+ * Fix: integrate with Ruby 3.2's `did_you_mean` library (Daniel Colson).
7
+ * Changed: explicitly define `#destroyed?` within the `Stub` strategy to return `false` to be consistent
8
+ with ActiveRecord (Benjamin Fleischer).
9
+ * Added: announce `factory_bot.compile_factory` notification (Sean Doyle).
10
+ * Docs: clarify that custom strategies need to define `#to_sym` (Edmund Korley, Jonas S).
11
+ * Docs: fix CI link in README (Mark Huk).
12
+ * Docs: fix GitHub links (Robert Fletcher).
13
+ * Docs: install this library with `bundle add` (Glauco Custódio).
14
+ * Docs: re-write into mdBook (Mike Burns, Sara Jackson, Stefanni Brasil)
15
+ * Docs: clarify that automatic trait definitions could introduce new linting errors (Lawrence Chou).
16
+ * Internal: skip TruffleRuby on Rails 5.0, 5.1, 5.2 (Andrii Konchyn).
17
+ * Internal: fix typoes throughout codebase (Yudai Takada).
18
+ * Internal: run CI on `actions/checkout` v3 (Yudai Takada).
19
+ * Internal: follow standardrb code style (Yudai Takada).
20
+ * Internal: stop using Hound (Daniel Nolan).
21
+ * Internal: only run simplecov on C Ruby (Daniel Colson).
22
+ * Internal: quieter Cucumber (Daniel Colson).
23
+ * Internal: Ruby 3.2 support (Daniel Colson).
24
+ * Internal: Mike Burns is the CODEOWNER (Stefanni Brasil).
25
+
26
+ ## 6.2.1 (March 8, 2022)
27
+ * Added: CI testing against truffleruby
28
+ * Changed: Documentation improvements for sequences and traits
29
+ * Fixed: ActiveSupport::Notifications reporting strategy through associations now report as symbols
30
+ * BREAKING CHANGE: Custom strategies now need to define a `to_sym` method to specify the strategy identifier
31
+ * Fixed: `add_attribute` with reserved keywords assigns values correctly
32
+
3
33
  ## 6.2.0 (May 7, 2021)
4
34
  * Added: support for Ruby 3.0
5
35
  * Changed: Include factory or trait name in error messages for missing traits. d05a9a3c
@@ -21,7 +51,9 @@
21
51
  * Added: automatic definition of traits for Active Record enum attributes, enabled by default
22
52
  (Note that this required changing where factory_bot constantizes the build
23
53
  class, which may affect applications that were using abstract factories for
24
- inheritance. See issue #1409.)
54
+ inheritance. See issue #1409.) (This may break `FactoryBot.lint` because
55
+ there may be previously non-existing factory+trait combinations being
56
+ defined and checked)
25
57
  * Added: `traits_for_enum` method to define traits for non-Active Record enums
26
58
  * Added: `build_stubbed_starting_id=` option to define the starting id for `build_stubbed`
27
59
  * Removed: deprecated methods on the top-level `FactoryBot` module meant only for internal use
data/README.md CHANGED
@@ -16,24 +16,26 @@ Check out the [guide](https://github.com/thoughtbot/factory_bot/blob/4-9-0-stabl
16
16
  Documentation
17
17
  -------------
18
18
 
19
- You should find the documentation for your version of factory_bot on [Rubygems](https://rubygems.org/gems/factory_bot).
19
+ See our extensive reference, guides, and cookbook in [the factory_bot book][].
20
20
 
21
- See [GETTING_STARTED] for information on defining and using factories. We also
22
- have [a detailed introductory video][], available for free on Upcase.
21
+ For information on integrations with third party libraries, such as RSpec or
22
+ Rails, see [the factory_bot wiki][].
23
+
24
+ We also have [a detailed introductory video][], available for free on Upcase.
23
25
 
24
26
  [a detailed introductory video]: https://upcase.com/videos/factory-bot?utm_source=github&utm_medium=open-source&utm_campaign=factory-girl
27
+ [the factory_bot book]: https://thoughtbot.github.io/factory_bot
28
+ [the factory_bot wiki]: https://github.com/thoughtbot/factory_bot/wiki
25
29
 
26
30
  Install
27
31
  --------
28
32
 
29
- Add the following line to Gemfile:
33
+ Run:
30
34
 
31
35
  ```ruby
32
- gem 'factory_bot'
36
+ bundle add factory_bot
33
37
  ```
34
38
 
35
- and run `bundle install` from your shell.
36
-
37
39
  To install the gem manually from your shell, run:
38
40
 
39
41
  ```shell
@@ -43,7 +45,7 @@ gem install factory_bot
43
45
  Supported Ruby versions
44
46
  -----------------------
45
47
 
46
- Supported Ruby versions are listed in [`.github/workflows/build.yml`](https://github.com/thoughtbot/factory_bot/blob/master/.github/workflows/build.yml)
48
+ Supported Ruby versions are listed in [`.github/workflows/build.yml`](https://github.com/thoughtbot/factory_bot/blob/main/.github/workflows/build.yml)
47
49
 
48
50
  More Information
49
51
  ----------------
@@ -53,8 +55,8 @@ More Information
53
55
  * [Issues](https://github.com/thoughtbot/factory_bot/issues)
54
56
  * [GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS](https://robots.thoughtbot.com/)
55
57
 
56
- [GETTING_STARTED]: https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md
57
- [NAME]: https://github.com/thoughtbot/factory_bot/blob/master/NAME.md
58
+ [GETTING_STARTED]: https://github.com/thoughtbot/factory_bot/blob/main/GETTING_STARTED.md
59
+ [NAME]: https://github.com/thoughtbot/factory_bot/blob/main/NAME.md
58
60
 
59
61
  Useful Tools
60
62
  ------------
@@ -64,7 +66,7 @@ Useful Tools
64
66
  Contributing
65
67
  ------------
66
68
 
67
- Please see [CONTRIBUTING.md](https://github.com/thoughtbot/factory_bot/blob/master/CONTRIBUTING.md).
69
+ Please see [CONTRIBUTING.md](https://github.com/thoughtbot/factory_bot/blob/main/CONTRIBUTING.md).
68
70
 
69
71
  factory_bot was originally written by Joe Ferris and is maintained by thoughtbot.
70
72
  Many improvements and bugfixes were contributed by the [open source
@@ -73,11 +75,11 @@ community](https://github.com/thoughtbot/factory_bot/graphs/contributors).
73
75
  License
74
76
  -------
75
77
 
76
- factory_bot is Copyright © 2008-2020 Joe Ferris and thoughtbot. It is free
78
+ factory_bot is Copyright © 2008-2022 Joe Ferris and thoughtbot. It is free
77
79
  software, and may be redistributed under the terms specified in the
78
80
  [LICENSE] file.
79
81
 
80
- [LICENSE]: https://github.com/thoughtbot/factory_bot/blob/master/LICENSE
82
+ [LICENSE]: https://github.com/thoughtbot/factory_bot/blob/main/LICENSE
81
83
 
82
84
 
83
85
  About thoughtbot
@@ -94,8 +96,8 @@ See [our other projects][community] or
94
96
 
95
97
  [community]: https://thoughtbot.com/community?utm_source=github
96
98
  [hire]: https://thoughtbot.com/hire-us?utm_source=github
97
- [ci-image]: https://github.com/thoughtbot/factory_bot/actions/workflows/build.yml/badge.svg
98
- [ci]: https://github.com/thoughtbot/factory_bot/actions?query=workflow%3A.github%2Fworkflows%2Fbuild.yml+branch%3Amaster++
99
+ [ci-image]: https://github.com/thoughtbot/factory_bot/actions/workflows/build.yml/badge.svg?branch=main
100
+ [ci]: https://github.com/thoughtbot/factory_bot/actions?query=workflow%3ABuild+branch%3Amain
99
101
  [grade-image]: https://codeclimate.com/github/thoughtbot/factory_bot/badges/gpa.svg
100
102
  [grade]: https://codeclimate.com/github/thoughtbot/factory_bot
101
103
  [version-image]: https://badge.fury.io/rb/factory_bot.svg
@@ -10,7 +10,7 @@ module FactoryBot
10
10
 
11
11
  def self.aliases_for(attribute)
12
12
  aliases.map { |(pattern, replace)|
13
- if pattern.match(attribute.to_s)
13
+ if pattern.match?(attribute)
14
14
  attribute.to_s.sub(pattern, replace).to_sym
15
15
  end
16
16
  }.compact << attribute
@@ -12,8 +12,8 @@ module FactoryBot
12
12
 
13
13
  -> {
14
14
  value = case block.arity
15
- when 1, -1, -2 then instance_exec(self, &block)
16
- else instance_exec(&block)
15
+ when 1, -1, -2 then instance_exec(self, &block)
16
+ else instance_exec(&block)
17
17
  end
18
18
  raise SequenceAbuseError if FactoryBot::Sequence === value
19
19
 
@@ -37,8 +37,9 @@ module FactoryBot
37
37
  end
38
38
 
39
39
  def decorated_evaluator
40
- Decorator::InvocationTracker.new(
41
- Decorator::NewConstructor.new(@evaluator, @build_class)
40
+ Decorator::NewConstructor.new(
41
+ Decorator::InvocationTracker.new(@evaluator),
42
+ @build_class
42
43
  )
43
44
  end
44
45
 
@@ -17,7 +17,7 @@ module FactoryBot
17
17
  end
18
18
  RUBY
19
19
  else
20
- def method_missing(name, *args, &block) # rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
20
+ def method_missing(name, *args, &block) # rubocop:disable Style/MissingRespondToMissing
21
21
  @component.send(name, *args, &block)
22
22
  end
23
23
 
@@ -57,6 +57,13 @@ module FactoryBot
57
57
  end
58
58
 
59
59
  @compiled = true
60
+
61
+ ActiveSupport::Notifications.instrument "factory_bot.compile_factory", {
62
+ name: name,
63
+ attributes: declarations.attributes,
64
+ traits: defined_traits,
65
+ class: klass
66
+ }
60
67
  end
61
68
  end
62
69
 
@@ -115,15 +122,26 @@ module FactoryBot
115
122
  raise error_with_definition_name(error)
116
123
  end
117
124
 
118
- def error_with_definition_name(error)
119
- message = error.message
120
- message.insert(
121
- message.index("\nDid you mean?") || message.length,
122
- " referenced within \"#{name}\" definition"
123
- )
125
+ # detailed_message introduced in Ruby 3.2 for cleaner integration with
126
+ # did_you_mean. See https://bugs.ruby-lang.org/issues/18564
127
+ if KeyError.method_defined?(:detailed_message)
128
+ def error_with_definition_name(error)
129
+ message = error.message + " referenced within \"#{name}\" definition"
124
130
 
125
- error.class.new(message).tap do |new_error|
126
- new_error.set_backtrace(error.backtrace)
131
+ error.class.new(message, key: error.key, receiver: error.receiver)
132
+ .tap { |new_error| new_error.set_backtrace(error.backtrace) }
133
+ end
134
+ else
135
+ def error_with_definition_name(error)
136
+ message = error.message
137
+ message.insert(
138
+ message.index("\nDid you mean?") || message.length,
139
+ " referenced within \"#{name}\" definition"
140
+ )
141
+
142
+ error.class.new(message).tap do |new_error|
143
+ new_error.set_backtrace(error.backtrace)
144
+ end
127
145
  end
128
146
  end
129
147
 
@@ -88,7 +88,7 @@ module FactoryBot
88
88
  # end
89
89
  #
90
90
  # are equivalent.
91
- def method_missing(name, *args, &block) # rubocop:disable Style/MissingRespondToMissing, Style/MethodMissingSuper
91
+ def method_missing(name, *args, &block) # rubocop:disable Style/MissingRespondToMissing
92
92
  association_options = args.first
93
93
 
94
94
  if association_options.nil?
@@ -151,7 +151,7 @@ module FactoryBot
151
151
  def association(name, *options)
152
152
  if block_given?
153
153
  raise AssociationDefinitionError.new(
154
- "Unexpected block passed to '#{name}' association "\
154
+ "Unexpected block passed to '#{name}' association " \
155
155
  "in '#{@definition.name}' factory"
156
156
  )
157
157
  else
@@ -24,7 +24,7 @@ module FactoryBot
24
24
  def association(factory_name, *traits_and_overrides)
25
25
  overrides = traits_and_overrides.extract_options!
26
26
  strategy_override = overrides.fetch(:strategy) {
27
- FactoryBot.use_parent_strategy ? @build_strategy.class : :create
27
+ FactoryBot.use_parent_strategy ? @build_strategy.to_sym : :create
28
28
  }
29
29
 
30
30
  traits_and_overrides += [overrides.except(:strategy)]
@@ -35,7 +35,7 @@ module FactoryBot
35
35
 
36
36
  attr_accessor :instance
37
37
 
38
- def method_missing(method_name, *args, &block) # rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
38
+ def method_missing(method_name, *args, &block)
39
39
  if @instance.respond_to?(method_name)
40
40
  @instance.send(method_name, *args, &block)
41
41
  else
@@ -39,9 +39,21 @@ module FactoryBot
39
39
 
40
40
  def key_error_with_custom_message(key_error)
41
41
  message = key_error.message.sub("key not found", "#{@name} not registered")
42
- error = KeyError.new(message)
43
- error.set_backtrace(key_error.backtrace)
44
- error
42
+ new_key_error(message, key_error).tap do |error|
43
+ error.set_backtrace(key_error.backtrace)
44
+ end
45
+ end
46
+
47
+ # detailed_message introduced in Ruby 3.2 for cleaner integration with
48
+ # did_you_mean. See https://bugs.ruby-lang.org/issues/18564
49
+ if KeyError.method_defined?(:detailed_message)
50
+ def new_key_error(message, key_error)
51
+ KeyError.new(message, key: key_error.key, receiver: key_error.receiver)
52
+ end
53
+ else
54
+ def new_key_error(message, _)
55
+ KeyError.new(message)
56
+ end
45
57
  end
46
58
  end
47
59
  end
@@ -8,6 +8,10 @@ module FactoryBot
8
8
  def result(evaluation)
9
9
  evaluation.hash
10
10
  end
11
+
12
+ def to_sym
13
+ :attributes_for
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -10,6 +10,10 @@ module FactoryBot
10
10
  evaluation.notify(:after_build, instance)
11
11
  end
12
12
  end
13
+
14
+ def to_sym
15
+ :build
16
+ end
13
17
  end
14
18
  end
15
19
  end
@@ -13,6 +13,10 @@ module FactoryBot
13
13
  evaluation.notify(:after_create, instance)
14
14
  end
15
15
  end
16
+
17
+ def to_sym
18
+ :create
19
+ end
16
20
  end
17
21
  end
18
22
  end
@@ -6,6 +6,10 @@ module FactoryBot
6
6
 
7
7
  def result(evaluation)
8
8
  end
9
+
10
+ def to_sym
11
+ :null
12
+ end
9
13
  end
10
14
  end
11
15
  end
@@ -41,6 +41,10 @@ module FactoryBot
41
41
  end
42
42
  end
43
43
 
44
+ def to_sym
45
+ :stub
46
+ end
47
+
44
48
  private
45
49
 
46
50
  def next_id
@@ -62,12 +66,12 @@ module FactoryBot
62
66
  end
63
67
 
64
68
  def destroyed?
65
- nil
69
+ false
66
70
  end
67
71
 
68
72
  DISABLED_PERSISTENCE_METHODS.each do |write_method|
69
73
  define_singleton_method(write_method) do |*args|
70
- raise "stubbed models are not allowed to access the database - "\
74
+ raise "stubbed models are not allowed to access the database - " \
71
75
  "#{self.class}##{write_method}(#{args.join(",")})"
72
76
  end
73
77
  end
@@ -1,3 +1,3 @@
1
1
  module FactoryBot
2
- VERSION = "6.2.0".freeze
2
+ VERSION = "6.3.0".freeze
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factory_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.2.0
4
+ version: 6.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Clayton
8
8
  - Joe Ferris
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-05-07 00:00:00.000000000 Z
12
+ date: 2023-09-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -236,8 +236,9 @@ files:
236
236
  homepage: https://github.com/thoughtbot/factory_bot
237
237
  licenses:
238
238
  - MIT
239
- metadata: {}
240
- post_install_message:
239
+ metadata:
240
+ changelog_uri: https://github.com/thoughtbot/factory_bot/blob/main/NEWS.md
241
+ post_install_message:
241
242
  rdoc_options: []
242
243
  require_paths:
243
244
  - lib
@@ -252,8 +253,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
253
  - !ruby/object:Gem::Version
253
254
  version: '0'
254
255
  requirements: []
255
- rubygems_version: 3.2.16
256
- signing_key:
256
+ rubygems_version: 3.4.13
257
+ signing_key:
257
258
  specification_version: 4
258
259
  summary: factory_bot provides a framework and DSL for defining and using model instance
259
260
  factories.