factory_bot_rails 6.4.3 → 6.5.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70ac3e65ecb946bde74a107d453206896d96a0bdd02d52f6e9d99cc4b11ace65
4
- data.tar.gz: c5478bf4191651ac02e944af9d118f2243b10fd508073b0911c9b165ad6afd1e
3
+ metadata.gz: b57f9bdcf6302512e51ca8a0d833f74061aec2f9546be0ab0a7c55af6e414e4d
4
+ data.tar.gz: dee564c6e125c20d959b9ff77983413a6d4b834c7efcdfdde699a821cb19cc50
5
5
  SHA512:
6
- metadata.gz: 4ff19ee6c07babb79676b2ecea45b5abc8dcc6af75042409a3a4e373e9db91787b0f0506d626700303414fc9b2e50f355c2757e1ec9289fccdcf14b6239f30e8
7
- data.tar.gz: d1a7e2c0c2966eff606e58addc63fe1dba533934fcb45ff1c7399ce5afd5604f1efab1d755e133bcd54f6b12850c76df88108b74df0da19917864e0c94ad8b92
6
+ metadata.gz: 806fc74737f9fe90bd0463c8d44160f89d0ae407df0d0149cac0b901cab0a47513a5ad45e790eb3cbb4c73e0e64b993cf21469c0fb015514242a6ac023242122
7
+ data.tar.gz: f41886fd5253fa81e93bb652c1e6d155efdcc370f6b68cee949be59e09191c4a0766dd2b983d600e5c8988105f47e16a1d55c91d3826d63444e69a786ccd37db
data/NEWS.md CHANGED
@@ -3,6 +3,20 @@ there might not be any notable changes in new versions of this project.
3
3
 
4
4
  # NEWS
5
5
 
6
+ ## 6.5.0 (June 13, 2025)
7
+
8
+ * Add: First-party support for [`file_fixture`](https://api.rubyonrails.org/classes/ActiveSupport/Testing/FileFixtures.html#method-i-file_fixture) within factory blocks (Sean Doyle)
9
+ * Changed: Drop support for Ruby 3.0 (Fernando Perales)
10
+ * Changed: Add required Ruby version to the gemspec (Christoph Lipautz)
11
+ * Internal: Add Rails 7.2 to the test matrix (Raj Kumar)
12
+ * Internal: Add Rails 8.0 to the test matrix (James O'Neill)
13
+ * Internal: Run `standardrb` on CI runs (Christoph Lipautz)
14
+
15
+
16
+ ## 6.4.4 (October 25, 2024)
17
+
18
+ * Changed: Bump Factory Bot 6.5.0
19
+
6
20
  ## 6.4.3 (December 29, 2023)
7
21
 
8
22
  * Changed: allow sequence definitions for ActiveRecord primary keys (Mike
data/README.md CHANGED
@@ -84,6 +84,19 @@ using an empty array:
84
84
  config.factory_bot.definition_file_paths = []
85
85
  ```
86
86
 
87
+ ### File Fixture Support
88
+
89
+ Factories have access to [ActiveSupport::Testing::FileFixtures#file_fixture][]
90
+ helper to read files from tests.
91
+
92
+ To disable file fixture support, set `file_fixture_support = false`:
93
+
94
+ ```rb
95
+ config.factory_bot.file_fixture_support = false
96
+ ```
97
+
98
+ [ActiveSupport::Testing::FileFixtures#file_fixture]: https://api.rubyonrails.org/classes/ActiveSupport/Testing/FileFixtures.html#method-i-file_fixture
99
+
87
100
  ### Generators
88
101
 
89
102
  Including factory\_bot\_rails in the development group of your Gemfile
@@ -161,21 +174,27 @@ community](https://github.com/thoughtbot/factory_bot_rails/graphs/contributors).
161
174
 
162
175
  ## License
163
176
 
164
- factory_bot_rails is Copyright © 2008-2020 Joe Ferris and thoughtbot. It is free
177
+ factory_bot_rails is Copyright © 2008 Joe Ferris and thoughtbot. It is free
165
178
  software, and may be redistributed under the terms specified in the
166
179
  [LICENSE](LICENSE) file.
167
180
 
181
+ <!-- START /templates/footer.md -->
168
182
  ## About thoughtbot
169
183
 
170
- ![thoughtbot](https://thoughtbot.com/brand_assets/93:44.svg)
184
+ ![thoughtbot](https://thoughtbot.com/thoughtbot-logo-for-readmes.svg)
171
185
 
172
- factory_bot_rails is maintained and funded by thoughtbot, inc.
186
+ This repo is maintained and funded by thoughtbot, inc.
173
187
  The names and logos for thoughtbot are trademarks of thoughtbot, inc.
174
188
 
175
- We are passionate about open source software.
189
+ We love open source software!
176
190
  See [our other projects][community].
177
191
  We are [available for hire][hire].
178
192
 
193
+ [community]: https://thoughtbot.com/community?utm_source=github
194
+ [hire]: https://thoughtbot.com/hire-us?utm_source=github
195
+
196
+ <!-- END /templates/footer.md -->
197
+
179
198
  [fb]: https://github.com/thoughtbot/factory_bot
180
199
  [grade]: https://codeclimate.com/github/thoughtbot/factory_bot_rails
181
200
  [grade-image]: https://codeclimate.com/github/thoughtbot/factory_bot_rails.svg
@@ -0,0 +1,9 @@
1
+ module FactoryBotRails
2
+ module FileFixtureSupport
3
+ def self.included(klass)
4
+ klass.cattr_accessor :file_fixture_support
5
+
6
+ klass.delegate :file_fixture, to: "self.class.file_fixture_support"
7
+ end
8
+ end
9
+ end
@@ -4,6 +4,7 @@ require "factory_bot"
4
4
  require "factory_bot_rails/generator"
5
5
  require "factory_bot_rails/reloader"
6
6
  require "factory_bot_rails/factory_validator"
7
+ require "factory_bot_rails/file_fixture_support"
7
8
  require "rails"
8
9
 
9
10
  module FactoryBotRails
@@ -11,6 +12,7 @@ module FactoryBotRails
11
12
  config.factory_bot = ActiveSupport::OrderedOptions.new
12
13
  config.factory_bot.definition_file_paths = FactoryBot.definition_file_paths
13
14
  config.factory_bot.validator = FactoryBotRails::FactoryValidator.new
15
+ config.factory_bot.file_fixture_support = true
14
16
 
15
17
  initializer "factory_bot.set_fixture_replacement" do
16
18
  Generator.new(config).run
@@ -20,6 +22,22 @@ module FactoryBotRails
20
22
  FactoryBot.definition_file_paths = definition_file_paths
21
23
  end
22
24
 
25
+ config.after_initialize do
26
+ if config.factory_bot.file_fixture_support
27
+ FactoryBot::SyntaxRunner.include FactoryBotRails::FileFixtureSupport
28
+
29
+ ActiveSupport.on_load :active_support_test_case do
30
+ setup { FactoryBot::SyntaxRunner.file_fixture_support = self }
31
+ end
32
+
33
+ if defined?(RSpec) && RSpec.respond_to?(:configure)
34
+ RSpec.configure do |config|
35
+ config.before { FactoryBot::SyntaxRunner.file_fixture_support = self }
36
+ end
37
+ end
38
+ end
39
+ end
40
+
23
41
  config.after_initialize do |app|
24
42
  FactoryBot.find_definitions
25
43
  Reloader.new(app).run
@@ -0,0 +1,3 @@
1
+ module FactoryBotRails
2
+ VERSION = "6.5.0".freeze
3
+ end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factory_bot_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.4.3
4
+ version: 6.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Ferris
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-12-30 00:00:00.000000000 Z
10
+ date: 2025-06-13 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: factory_bot
@@ -16,30 +15,58 @@ dependencies:
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '6.4'
18
+ version: '6.5'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: '6.4'
25
+ version: '6.5'
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: railties
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - ">="
32
31
  - !ruby/object:Gem::Version
33
- version: 5.0.0
32
+ version: 6.1.0
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - ">="
39
38
  - !ruby/object:Gem::Version
40
- version: 5.0.0
39
+ version: 6.1.0
41
40
  - !ruby/object:Gem::Dependency
42
- name: sqlite3
41
+ name: activerecord
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 6.1.0
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 6.1.0
54
+ - !ruby/object:Gem::Dependency
55
+ name: activestorage
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 6.1.0
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: 6.1.0
68
+ - !ruby/object:Gem::Dependency
69
+ name: mutex_m
43
70
  requirement: !ruby/object:Gem::Requirement
44
71
  requirements:
45
72
  - - ">="
@@ -53,21 +80,21 @@ dependencies:
53
80
  - !ruby/object:Gem::Version
54
81
  version: '0'
55
82
  - !ruby/object:Gem::Dependency
56
- name: activerecord
83
+ name: sqlite3
57
84
  requirement: !ruby/object:Gem::Requirement
58
85
  requirements:
59
86
  - - ">="
60
87
  - !ruby/object:Gem::Version
61
- version: 5.0.0
88
+ version: '0'
62
89
  type: :development
63
90
  prerelease: false
64
91
  version_requirements: !ruby/object:Gem::Requirement
65
92
  requirements:
66
93
  - - ">="
67
94
  - !ruby/object:Gem::Version
68
- version: 5.0.0
69
- description: factory_bot_rails provides integration between factory_bot and rails
70
- 5.0 or newer
95
+ version: '0'
96
+ description: factory_bot_rails provides integration between factory_bot and Rails
97
+ 6.1 or newer
71
98
  email: jferris@thoughtbot.com
72
99
  executables: []
73
100
  extensions: []
@@ -80,12 +107,14 @@ files:
80
107
  - lib/factory_bot_rails.rb
81
108
  - lib/factory_bot_rails/definition_file_paths.rb
82
109
  - lib/factory_bot_rails/factory_validator.rb
110
+ - lib/factory_bot_rails/file_fixture_support.rb
83
111
  - lib/factory_bot_rails/generator.rb
84
112
  - lib/factory_bot_rails/generators/non_rspec_generator.rb
85
113
  - lib/factory_bot_rails/generators/null_generator.rb
86
114
  - lib/factory_bot_rails/generators/rspec_generator.rb
87
115
  - lib/factory_bot_rails/railtie.rb
88
116
  - lib/factory_bot_rails/reloader.rb
117
+ - lib/factory_bot_rails/version.rb
89
118
  - lib/generators/factory_bot.rb
90
119
  - lib/generators/factory_bot/model/model_generator.rb
91
120
  - lib/generators/factory_bot/model/templates/factories.erb
@@ -95,7 +124,6 @@ licenses:
95
124
  - MIT
96
125
  metadata:
97
126
  changelog_uri: https://github.com/thoughtbot/factory_bot_rails/blob/main/NEWS.md
98
- post_install_message:
99
127
  rdoc_options: []
100
128
  require_paths:
101
129
  - lib
@@ -103,16 +131,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
103
131
  requirements:
104
132
  - - ">="
105
133
  - !ruby/object:Gem::Version
106
- version: '0'
134
+ version: 3.0.0
107
135
  required_rubygems_version: !ruby/object:Gem::Requirement
108
136
  requirements:
109
137
  - - ">="
110
138
  - !ruby/object:Gem::Version
111
139
  version: '0'
112
140
  requirements: []
113
- rubygems_version: 3.4.10
114
- signing_key:
141
+ rubygems_version: 3.6.2
115
142
  specification_version: 4
116
- summary: factory_bot_rails provides integration between factory_bot and rails 5.0
143
+ summary: factory_bot_rails provides integration between factory_bot and Rails 6.1
117
144
  or newer
118
145
  test_files: []