database_rewinder 0.9.2 → 0.9.3

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: dd5388515381629b73558d7daa3907c06eb59ce55fbc6b6e5bdfc8a93e6b1872
4
- data.tar.gz: 775cc8b24d4808317b4a521e3fed5568380d6222837543141d71a7ccf264a595
3
+ metadata.gz: 446177e88aadd696c5c94de335a7b16aa1f6a0dd28c354a9bbda1c4d5f49e9be
4
+ data.tar.gz: b071df2532cb7cf4a8c74b35a7c84a620c89fec3ffc499c908439fc595a995ca
5
5
  SHA512:
6
- metadata.gz: ad1ae15b0ab5bd04ffd4908573b407a86a39ed2e35e5e2ae15b3502ba0dcfd3cb5edfa113759341f93923be88b98676597d53d268f673bbe846c6eba59507348
7
- data.tar.gz: cdc9a216be4b1a234df1dd83ad89234fb4c43bed3d4f4dec41a20a04526b1b0569f4c680d0ca64623ae4276253a2d96dd0637d5eee12192e51e670372b5269ce
6
+ metadata.gz: 0d0824e4a05ae8afa8bde488b5b8fd8c7150316588f432852f39e7dfbc46bb2d43b9f72ba408c7568dc693d0cf366258f7eb93cb9f1030307eb3601959d5dd3e
7
+ data.tar.gz: f055c3a41b235b030a56525fbd596383bcf611709cf0b78d24d612cb996d0923b159e8624e24d7873b614275b0ebfa9c8b2dc4d4898e204180436cd8756e0748
@@ -5,17 +5,19 @@ addons:
5
5
  mysql: '5.7'
6
6
 
7
7
  before_install:
8
- - gem i rubygems-update -v '<3' && update_rubygems
9
- - "ruby -e 'exit RUBY_VERSION.to_f >= 2.6' && gem up bundler || gem i bundler -v '<2'"
8
+ # install older versions of rubygems and bundler only on Ruby < 2.7
9
+ - if [ `echo "${TRAVIS_RUBY_VERSION:0:3} < 2.7" | bc` == 1 ]; then gem i rubygems-update -v '<3' && update_rubygems; fi;
10
+ - if [ `echo "${TRAVIS_RUBY_VERSION:0:3} < 2.7" | bc` == 1 ]; then gem i bundler -v '<2'; fi;
10
11
  - sudo service mysql restart
11
12
 
12
13
 
13
14
  cache: bundler
14
15
 
15
16
  env:
16
- - DB=sqlite3
17
- - DB=mysql
18
- - DB=postgresql
17
+ matrix:
18
+ - DB=sqlite3
19
+ - DB=mysql
20
+ - DB=postgresql
19
21
 
20
22
  rvm:
21
23
  - 2.6.3
@@ -30,6 +32,9 @@ dist: xenial
30
32
 
31
33
  matrix:
32
34
  include:
35
+ - rvm: 2.7.1
36
+ gemfile: gemfiles/rails_60.gemfile
37
+ env: DB=postgresql
33
38
  - rvm: 2.6.3
34
39
  gemfile: gemfiles/rails_edge.gemfile
35
40
  env: DB=postgresql
@@ -6,7 +6,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
6
 
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = "database_rewinder"
9
- spec.version = '0.9.2'
9
+ spec.version = '0.9.3'
10
10
  spec.authors = ["Akira Matsuda"]
11
11
  spec.email = ["ronnie@dio.jp"]
12
12
  spec.description = "A minimalist's tiny and ultra-fast database cleaner"
@@ -73,7 +73,7 @@ module DatabaseRewinder
73
73
 
74
74
  # cache AR connection.tables
75
75
  def all_table_names(connection)
76
- cache_key = connection.pool.spec.config
76
+ cache_key = get_cache_key(connection.pool)
77
77
  #NOTE connection.tables warns on AR 5 with some adapters
78
78
  tables = ActiveSupport::Deprecation.silence { connection.tables }
79
79
  @table_names_cache[cache_key] ||= tables.reject do |t|
@@ -81,7 +81,17 @@ module DatabaseRewinder
81
81
  (ActiveRecord::Base.respond_to?(:internal_metadata_table_name) && (t == ActiveRecord::Base.internal_metadata_table_name))
82
82
  end
83
83
  end
84
+
85
+ def get_cache_key(connection_pool)
86
+ if connection_pool.respond_to?(:db_config) # ActiveRecord >= 6.1
87
+ connection_pool.db_config.config
88
+ else
89
+ connection_pool.spec.config
90
+ end
91
+ end
84
92
  end
93
+
94
+ private_class_method :get_cache_key
85
95
  end
86
96
 
87
97
  begin
@@ -7,9 +7,16 @@ module DatabaseRewinder
7
7
  super
8
8
  end
9
9
 
10
- def exec_query(sql, *)
11
- DatabaseRewinder.record_inserted_table self, sql
12
- super
10
+ if Rails::VERSION::MAJOR < 5
11
+ def exec_query(sql, *)
12
+ DatabaseRewinder.record_inserted_table self, sql
13
+ super
14
+ end
15
+ else
16
+ def exec_query(sql, *, **)
17
+ DatabaseRewinder.record_inserted_table self, sql
18
+ super
19
+ end
13
20
  end
14
21
  end
15
22
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module DatabaseRewinder
4
4
  module Compatibility
5
- def clean_with(*args)
6
- cleaners.each {|c| c.clean_with(*args)}
5
+ def clean_with(*args, **opts)
6
+ cleaners.each {|c| c.clean_with(*args, **opts)}
7
7
  end
8
8
 
9
9
  def cleaning
@@ -36,7 +36,7 @@ module DatabaseRewinder
36
36
  # DatabaseRewinder[:active_record, connection: 'the_db_name']
37
37
  #
38
38
  # You can cleanup multiple databases for each test using this configuration.
39
- def [](orm, connection: nil, **)
39
+ def [](orm = nil, connection: nil, **)
40
40
  if connection.nil?
41
41
  if orm.is_a? String
42
42
  connection = orm
@@ -183,7 +183,7 @@ class DatabaseRewinder::DatabaseRewinderTest < ActiveSupport::TestCase
183
183
  @except = @cleaner.instance_variable_get(:@except)
184
184
  Foo.create! name: 'foo1'
185
185
  Bar.create! name: 'bar1'
186
- DatabaseRewinder.clean_with :truncation, options
186
+ DatabaseRewinder.clean_with :truncation, **options
187
187
  end
188
188
 
189
189
  test 'with only option' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: database_rewinder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira Matsuda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-03 00:00:00.000000000 Z
11
+ date: 2020-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -163,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
163
  - !ruby/object:Gem::Version
164
164
  version: '0'
165
165
  requirements: []
166
- rubygems_version: 3.0.3
166
+ rubygems_version: 3.2.0.pre1
167
167
  signing_key:
168
168
  specification_version: 4
169
169
  summary: A minimalist's tiny and ultra-fast database cleaner