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 +4 -4
- data/README.md +13 -13
- data/lib/fixture_farm/fixture_recorder.rb +2 -0
- data/lib/fixture_farm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 205e12a455e71ef917424e9451052b3be1517b11d46f9066a5311d51e889a667
|
4
|
+
data.tar.gz: 360d8805f8844a6a391cf5877f13a9f2433820a6bb94c0d35ee29444ae08b415
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
145
|
+
@original_queue_adapter = ActiveJob::Base.queue_adapter
|
146
146
|
# This is so that variants get generated and blobs analyzed
|
147
|
-
|
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
|
-
|
154
|
+
ActiveJob::Base.queue_adapter = @original_queue_adapter
|
155
155
|
ActiveStorage::Blob.service = @original_storage_service
|
156
156
|
end
|
157
157
|
end
|
data/lib/fixture_farm/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2025-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|