fixture_bot 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8eb18affd0227587d706dcbd9f598b1118f175cba7f0b7abd29ddf57618a42af
4
- data.tar.gz: 23f67409d1c4bde7b00e757cacfbfc34885954915e492f4730c8c3c5dd50050b
3
+ metadata.gz: 55e1c0684eed79ec6b077d7e9459afec9aa884e47c999963aeef4f4914a3bee5
4
+ data.tar.gz: 8b856c48c24ec4567a5ed2cf5cdeda4d125ff94aad321822d65264319a501bf8
5
5
  SHA512:
6
- metadata.gz: 726a157de2ec6dd416daeba4783023754cce5ebc47982364a82ed0cf1962a34b4e5ac66f528fc335650a5c2f9258a5fba11d3e4ade6d1787c1b4632d03c9cd08
7
- data.tar.gz: a724d0bf57b9c2ae3afea43d65d38b626394807cd8494df0c36f1f23417ad6bca42c92a4152447f0aa679dbaac1191256b59665b396d3da50ce32590c61af41e
6
+ metadata.gz: f4849de201e6c43a1b84d8043fe295cb137cbbc97d81eba1a4558f6c65bc930b00158842742af182fb1296ffbd6b8433715726cb7b97d172f8e68a3abf4e1ed3
7
+ data.tar.gz: daf184bd8d5e207a3b81bd1d5d0f8c621080de4dad20e5b33eb8a2ef7cdc5e5dfa7b0f28d4d079ba5cce71193247b4c7dce488dc170ef2e32a45f46be1722b52
data/README.md CHANGED
@@ -125,29 +125,25 @@ end
125
125
  ## Benchmarks
126
126
  #### factories vs fixtures
127
127
 
128
- simple model with 10 fields
129
128
  ```ruby
129
+ # simple model with 10 fields
130
130
  Benchmark.ips do |x|
131
- x.report("fixture") { brands(:lux) }. # fixture: 4666.2 i/s
132
- x.report("factory") { create(:brand) } # factory: 1077.8 i/s - 4.33x slower
131
+ x.report("fixture") { brands(:lux) }. # fixture: 4666.2 i/s
132
+ x.report("factory") { create(:brand) } # factory: 1077.8 i/s - 4.33x slower
133
133
  x.compare!
134
134
  end
135
- ```
136
135
 
137
- user model with 40+ fields, 1 association
138
- ```ruby
136
+ # user model with 40+ fields, 1 association
139
137
  Benchmark.ips do |x|
140
- x.report("fixture") { users(:with_post_index)} # fixture: 3395.4 i/s
141
- x.report("factory") { create(:user) } # factory: 159.6 i/s - 21.27x slower
138
+ x.report("fixture") { users(:with_post_index)} # fixture: 3395.4 i/s
139
+ x.report("factory") { create(:user) } # factory: 159.6 i/s - 21.27x slower
142
140
  x.compare!
143
141
  end
144
- ```
145
142
 
146
- product model with 40+ fields, 5+ associations
147
- ```ruby
143
+ # product model with 40+ fields, 5+ associations
148
144
  Benchmark.ips do |x|
149
- x.report("fixture") { products(:available) } # fixture: 3564.3 i/s
150
- x.report("factory") { create(:product, :available) } # factory: 67.7 i/s - 52.68x slower
145
+ x.report("fixture") { products(:available) } # fixture: 3564.3 i/s
146
+ x.report("factory") { create(:product, :available) } # factory: 67.7 i/s - 52.68x slower
151
147
  x.compare!
152
148
  end
153
149
  ```
@@ -63,7 +63,7 @@ module FixtureBot
63
63
  private def fixture_with_id(table, name, &)
64
64
  _, record_id = fixture(table, name, &)
65
65
 
66
- if ::ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
66
+ if ::ActiveRecord::Base.connection.respond_to?(:postgresql_version)
67
67
  ::ActiveRecord::Base.connection.execute <<~SQL
68
68
  SELECT setval(pg_get_serial_sequence('#{table}', 'id'), GREATEST(#{record_id}, nextval(pg_get_serial_sequence('#{table}', 'id'))))
69
69
  SQL
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FixtureBot
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fixture_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ermolaev Andrey
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-30 00:00:00.000000000 Z
11
+ date: 2024-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord