fixture_farm 1.1.1 → 1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d3a39068e7447367066d1947cf1f14d16366d10e88e91ae922ff3953b7667ff5
4
- data.tar.gz: 7f28f26923b51368511ed5ef8c55531f2d405ba36d11ea802caedbc554fbcf0a
3
+ metadata.gz: 205e12a455e71ef917424e9451052b3be1517b11d46f9066a5311d51e889a667
4
+ data.tar.gz: 360d8805f8844a6a391cf5877f13a9f2433820a6bb94c0d35ee29444ae08b415
5
5
  SHA512:
6
- metadata.gz: 84a8649ace5e14d8dd09b94cdde3d15f02ebd8bd602f706b48ec48f9bff9ab4ea0170fd26827886ee8b0595909d930ce16e61d21e422df9b9e9a7c545df248b7
7
- data.tar.gz: d25f84374a79d33ee8ee117656c59e7523d4087dd3dc9065de7a540b882b5cd2fd9897e4aee3aa23af3a8f0eb43ee5168efb2d390dc12ecbde8b1a3b0fd22656
6
+ metadata.gz: 303bb7ecad05b844de71cbe3a68a814ec70a76b4adfa2eaf570752bf6de253c87c85b2a795ec69d6d0b6a7530753a73033df1d2b45366814846d401528272184
7
+ data.tar.gz: 6fdb88f7da8c21e4531152b7a1262b951ed0622a000cd27c61b1fc1f47ccebf5b64ca4c1cad1387e02d93612f82c71c0b73a88e7b0c6f33b2bbcf592a4d33d37
data/README.md CHANGED
@@ -93,6 +93,16 @@ Assuming there was a parent fixture `dave` that didn't have any children, this t
93
93
 
94
94
  `record_fixtures` accepts optional name prefix, that applies to all new fixture names.
95
95
 
96
+ ### Automatic fixture naming
97
+
98
+ Generated fixture names are based on the first `belongs_to` association of the model. E.g., if a new post fixtures belongs_to to a user fixture `bob`, the name is going to be `bob_post_1`.
99
+
100
+ It's possible to lower the priority of given parent assiciations when it comes to naming, so that certain names are only picked when there are no other suitable parent associations. This is useful, for example, to exclude `acts_as_tenant` association:
101
+
102
+ ```ruby
103
+ FixtureFarm.low_priority_parent_model_for_naming = -> { _1.is_a?(TenantModel) }
104
+ ```
105
+
96
106
  #### Fixture Name Replacement
97
107
 
98
108
  `record_fixtures` also supports hash arguments for advanced fixture naming control:
@@ -112,16 +122,6 @@ For example:
112
122
  - A user fixture that would be named `client_1_user_1` becomes `new_client_user_1` (replacement)
113
123
  - A user fixture that would be named `user_1` becomes `new_client_user_1` (prefixing)
114
124
 
115
- ### Automatic fixture naming
116
-
117
- Generated fixture names are based on the first `belongs_to` association of the model. E.g., if a new post fixtures belongs_to to a user fixture `bob`, the name is going to be `bob_post_1`.
118
-
119
- It's possible to lower the priority of given parent assiciations when it comes to naming, so that certain names are only picked when there are no other suitable parent associations. This is useful, for example, to exclude `acts_as_tenant` association:
120
-
121
- ```ruby
122
- FixtureFarm.low_priority_parent_model_for_naming = -> { _1.is_a?(TenantModel) }
123
- ```
124
-
125
125
  ### Attachment fixtures
126
126
 
127
127
  Rather than [manually crafting attachment fixtures](https://guides.rubyonrails.org/v8.0/active_storage_overview.html#adding-attachments-to-fixtures), we can get the gem to do the work. Not only is this less boring, but it's also going to generate variant fixtures.
@@ -142,16 +142,16 @@ Now a test like the one below is either going to fail if some product fixtures h
142
142
  ```ruby
143
143
  if ENV["GENERATE_FIXTURES"]
144
144
  setup do
145
- @original_queue_adapter = Rails.configuration.active_job.queue_adapter
145
+ @original_queue_adapter = ActiveJob::Base.queue_adapter
146
146
  # This is so that variants get generated and blobs analyzed
147
- Rails.configuration.active_job.queue_adapter = :inline
147
+ ActiveJob::Base.queue_adapter = :inline
148
148
 
149
149
  @original_storage_service = ActiveStorage::Blob.service
150
150
  ActiveStorage::Blob.service = ActiveStorage::Blob.services.fetch(:test_fixtures)
151
151
  end
152
152
 
153
153
  teardown do
154
- Rails.configuration.active_job.queue_adapter = @original_queue_adapter
154
+ ActiveJob::Base.queue_adapter = @original_queue_adapter
155
155
  ActiveStorage::Blob.service = @original_storage_service
156
156
  end
157
157
  end
@@ -266,6 +266,8 @@ module FixtureFarm
266
266
  value.to_f
267
267
  when Hash
268
268
  value.to_json
269
+ when IPAddr
270
+ value.to_s
269
271
  else
270
272
  value
271
273
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FixtureFarm
4
- VERSION = '1.1.1'
4
+ VERSION = '1.1.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fixture_farm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - artemave
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-10 00:00:00.000000000 Z
11
+ date: 2025-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails