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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 205e12a455e71ef917424e9451052b3be1517b11d46f9066a5311d51e889a667
4
- data.tar.gz: 360d8805f8844a6a391cf5877f13a9f2433820a6bb94c0d35ee29444ae08b415
3
+ metadata.gz: 92b468fd49d2062a518429bf20576066f827ff474c96bdf6fcab066ac5657824
4
+ data.tar.gz: '09980fce3fdb708ae0b9803a10b8c04970a9fa78dfe55cf737c2a30b6818c8a8'
5
5
  SHA512:
6
- metadata.gz: 303bb7ecad05b844de71cbe3a68a814ec70a76b4adfa2eaf570752bf6de253c87c85b2a795ec69d6d0b6a7530753a73033df1d2b45366814846d401528272184
7
- data.tar.gz: 6fdb88f7da8c21e4531152b7a1262b951ed0622a000cd27c61b1fc1f47ccebf5b64ca4c1cad1387e02d93612f82c71c0b73a88e7b0c6f33b2bbcf592a4d33d37
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
- For example:
122
- - A user fixture that would be named `client_1_user_1` becomes `new_client_user_1` (replacement)
123
- - A user fixture that would be named `user_1` becomes `new_client_user_1` (prefixing)
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|name_prefix:replaces_name]'
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:user_1" into {new_user: :user_1}
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 |new_name, old_name|
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}_")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FixtureFarm
4
- VERSION = '1.1.2'
4
+ VERSION = '1.2.0'
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.2
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-08-28 00:00:00.000000000 Z
11
+ date: 2025-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails