fixture_kit 0.6.0 → 0.7.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: 9c4966344ca2fed5d11b47404694babb874ee5ac505ed64fda79acab147b4230
4
- data.tar.gz: da1b34e717a3e6aa1b776b6be68e71c104d28612b879daf1b63c30a0b83244e0
3
+ metadata.gz: 6625febace1194e8bfdef5c43ab86865d8e26068e6d7593be897d6898cbfe3ab
4
+ data.tar.gz: f4c1ccb43f872b81ac31c4fe89d113904d82d3704a639772e12180ae423ec900
5
5
  SHA512:
6
- metadata.gz: 8d127ec7c68e6839bda857231d2fe0f70263d208aad9615834cad70e47ea2cbecd3b270dea7f795d02452a72b0f155694b3c6e78eb589349a639e7158bfcf902
7
- data.tar.gz: 69149bc49f370405cd89043eced96984cc4a3a3efa3e85ce3e45ba15a4859db3805862b14ebfb7171a7b88059d52e1479b201fbb2ee582b379be6c8ef2de9830
6
+ metadata.gz: 22f9d60285534cde9741026a75ad278795f33a37e9af26c6ee4321b53f7474cdab7b3fd09728a4a40f5e3cedb678bc30a596f7b9e9670b780ff43126ca693bb3
7
+ data.tar.gz: 5c5a7608698b7b190e9c8863ecc66cc9c96ce0aee89431ed941b568fdbf63e184cc9f699d2aab1a220a160dc674c2d49e44f38093f88c07838beeeda8def9ef6
@@ -97,7 +97,7 @@ module FixtureKit
97
97
  columns = model.column_names
98
98
 
99
99
  rows = []
100
- model.order(:id).find_each do |record|
100
+ model.unscoped.order(:id).find_each do |record|
101
101
  row_values = columns.map do |col|
102
102
  value = record.read_attribute_before_type_cast(col)
103
103
  model.connection.quote(value)
@@ -132,11 +132,17 @@ module FixtureKit
132
132
  end
133
133
 
134
134
  def statements_by_connection(records)
135
+ deleted_tables = Set.new
135
136
  records.each_with_object({}) do |(model_name, sql), grouped|
136
137
  model = ActiveSupport::Inflector.constantize(model_name)
137
138
  connection = model.connection
138
139
  grouped[connection] ||= []
139
- grouped[connection] << build_delete_sql(model)
140
+
141
+ table_key = [connection, model.table_name]
142
+ if deleted_tables.add?(table_key)
143
+ grouped[connection] << build_delete_sql(model)
144
+ end
145
+
140
146
  grouped[connection] << sql if sql
141
147
  end
142
148
  end
@@ -20,7 +20,13 @@ module FixtureKit
20
20
 
21
21
  ActiveSupport::Notifications.subscribed(subscriber, EVENT, monotonic: true, &block)
22
22
 
23
- models.to_a
23
+ models.map { |model| base_table_model(model) }.uniq
24
24
  end
25
+
26
+ def self.base_table_model(model)
27
+ model = model.superclass until model.superclass.abstract_class?
28
+ model
29
+ end
30
+ private_class_method :base_table_model
25
31
  end
26
32
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FixtureKit
4
- VERSION = "0.6.0"
4
+ VERSION = "0.7.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fixture_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ngan Pham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-23 00:00:00.000000000 Z
11
+ date: 2026-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport