fixture_farm 1.1.2 → 1.2.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 +4 -4
- data/README.md +5 -5
- data/bin/fixture_farm.rb +2 -2
- data/lib/fixture_farm/fixture_recorder.rb +1 -1
- 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: 92b468fd49d2062a518429bf20576066f827ff474c96bdf6fcab066ac5657824
|
4
|
+
data.tar.gz: '09980fce3fdb708ae0b9803a10b8c04970a9fa78dfe55cf737c2a30b6818c8a8'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2982e7c153b5747d463005253c256594b7dbbf4ca8f622a44612581b7d6571834f5b28ae50d6f85c32a188c9b62f26a77f6160816cba52d5a5ab53a08e007958
|
7
|
+
data.tar.gz: f3f4958dcf22e728df77ead1d874a43ba603c5cfb6222bc7500848d5b06d327faad20291dbc8832e7db484e03dbf42dd90129c7fd39f1ce75d5475c397a85007
|
data/README.md
CHANGED
@@ -108,9 +108,9 @@ FixtureFarm.low_priority_parent_model_for_naming = -> { _1.is_a?(TenantModel) }
|
|
108
108
|
`record_fixtures` also supports hash arguments for advanced fixture naming control:
|
109
109
|
|
110
110
|
```ruby
|
111
|
-
# Replace 'client_1' with 'new_client' in fixture names, or use 'new_client' as prefix if not found
|
112
111
|
record_fixtures(new_client: :client_1) do
|
113
|
-
User.create!(name: 'Test User', email: 'test@example.com')
|
112
|
+
User.create!(name: 'Test User', email: 'test@example.com', client: clients(:client_1))
|
113
|
+
Star.create!
|
114
114
|
end
|
115
115
|
```
|
116
116
|
|
@@ -118,9 +118,9 @@ This works in two ways:
|
|
118
118
|
- **Replacement**: If a generated fixture name contains `client_1`, it gets replaced with `new_client`
|
119
119
|
- **Prefixing**: If a generated fixture name doesn't contain `client_1`, it gets prefixed with `new_client_`
|
120
120
|
|
121
|
-
|
122
|
-
-
|
123
|
-
-
|
121
|
+
In the above example:
|
122
|
+
- The user fixture would be named `client_1_user_1`, but the actual name will be `new_client_user_1` (replacement)
|
123
|
+
- The star fixture would be named `star_1`, but will be named `new_client_star_1` (prefixing)
|
124
124
|
|
125
125
|
### Attachment fixtures
|
126
126
|
|
data/bin/fixture_farm.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
require_relative '../lib/fixture_farm/fixture_recorder'
|
5
5
|
|
6
6
|
def usage
|
7
|
-
puts 'Usage: bundle exec fixture_farm <record|status|stop> [name_prefix|
|
7
|
+
puts 'Usage: bundle exec fixture_farm <record|status|stop> [name_prefix|old_name:new_name]'
|
8
8
|
exit 1
|
9
9
|
end
|
10
10
|
|
@@ -12,7 +12,7 @@ case ARGV[0]
|
|
12
12
|
when 'record'
|
13
13
|
prefix_arg = ARGV[1]
|
14
14
|
|
15
|
-
# Parse hash syntax like "new_user
|
15
|
+
# Parse hash syntax like "user_1:new_user" into {user_1: :new_user}
|
16
16
|
if prefix_arg&.include?(':')
|
17
17
|
parts = prefix_arg.split(':', 2)
|
18
18
|
parsed_prefix = { parts[0].to_sym => parts[1].to_sym }
|
@@ -382,7 +382,7 @@ module FixtureFarm
|
|
382
382
|
"#{model_instance.class.name.underscore.split('/').last}_1"
|
383
383
|
].select(&:present?).join('_')
|
384
384
|
|
385
|
-
@fixture_name_replacements.each do |
|
385
|
+
@fixture_name_replacements.each do |old_name, new_name|
|
386
386
|
# Only apply replacement if the base_name doesn't already start with new_name
|
387
387
|
# This prevents double-application of replacements
|
388
388
|
next if base_name.start_with?("#{new_name}_")
|
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.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- artemave
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|