database_rewinder 0.9.0 → 0.9.5

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: f3f3971ab455c27723cb88e96a001ad2971638b6f05d28d53893faaaeb287ddf
4
- data.tar.gz: a57feb32a0f17562fc512703bafc7706c6863a03adafda705f7ee9831b94225a
3
+ metadata.gz: b151e420c4e1985e5674d1781dceae421a9e3d9e19c3486cf87529ac14399008
4
+ data.tar.gz: e1ad8090d602a4db4d71626b765c6f932ac8690ae8dfeee40d429f8071465812
5
5
  SHA512:
6
- metadata.gz: a806f31a61677df1f79e664dcbdd21ca99814220c5d442d94b81dd6aa676c3cb1cab8b9639e0c1ced053131a276d207dfad3dbc374d091c0f6e31253da1e467f
7
- data.tar.gz: debe586e77d5ec3931497406202d85f9feae447e78ee868b745a84f762b2a19f6ac02340a843ad91184da8ba02a7b943e050a1d9bd8ea28b0cb04e59800ccc22
6
+ metadata.gz: acca967b5d15e66623e5767fcc9304d56e0d19074f5c02619e77c50f6dacfb51bf0289e6ef64252884f2b2fb88ae198b6abde6b152d0beaf7c13e2c4df290552
7
+ data.tar.gz: 9be584317f373acaa2797ff723b4e0a2e7e8121a0aecad1920ecb01b06307224e35238e10ede1a5ec43a3a4eb74511b760b132711c4cbf8dfb55d52700626d26
data/.travis.yml CHANGED
@@ -1,47 +1,71 @@
1
1
  language: ruby
2
2
 
3
+ addons:
4
+ postgresql: '9.4'
5
+ mysql: '5.7'
6
+
3
7
  before_install:
4
- - gem update --system
5
- - gem install bundler
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;
11
+ - sudo service mysql restart
12
+
6
13
 
7
14
  cache: bundler
8
15
 
9
16
  env:
10
- - DB=sqlite3
11
- - DB=mysql
12
- - DB=postgresql
17
+ matrix:
18
+ - DB=sqlite3
19
+ - DB=mysql
20
+ - DB=postgresql
13
21
 
14
22
  rvm:
15
- - 2.5.1
16
- - 2.4.4
17
- - 2.3.7
18
- - 2.2.10
23
+ - 2.7.3
19
24
 
20
25
  gemfile:
21
26
  - gemfiles/rails_52.gemfile
22
- - gemfiles/rails_51.gemfile
23
- - gemfiles/rails_50.gemfile
24
- - gemfiles/rails_42.gemfile
27
+ - gemfiles/rails_60.gemfile
28
+ - gemfiles/rails_61.gemfile
25
29
 
26
30
  sudo: false
27
31
 
32
+ dist: xenial
33
+
28
34
  matrix:
29
35
  include:
30
- - rvm: 2.5.1
36
+ - rvm: 3.0.1
31
37
  gemfile: gemfiles/rails_edge.gemfile
32
- env: DB=sqlite3
33
- - rvm: 2.3.7
38
+ env: DB=postgresql
39
+ - rvm: 3.0.1
40
+ gemfile: gemfiles/rails_61.gemfile
41
+ env: DB=postgresql
42
+ - rvm: 2.6.7
43
+ gemfile: gemfiles/rails_60.gemfile
44
+ env: DB=postgresql
45
+ - rvm: 2.6.7
46
+ gemfile: gemfiles/rails_52.gemfile
47
+ env: DB=postgresql
48
+ - rvm: 2.5.9
49
+ gemfile: gemfiles/rails_51.gemfile
50
+ env: DB=postgresql
51
+ - rvm: 2.4.10
52
+ gemfile: gemfiles/rails_50.gemfile
53
+ env: DB=postgresql
54
+ - rvm: 2.3.8
34
55
  gemfile: gemfiles/rails_41.gemfile
35
- env: DB=sqlite3
36
- - rvm: 2.3.7
56
+ env: DB=postgresql
57
+ - rvm: 2.3.8
37
58
  gemfile: gemfiles/rails_40.gemfile
38
- env: DB=sqlite3
59
+ env: DB=postgresql
60
+ - rvm: 2.2.10
61
+ gemfile: gemfiles/rails_52.gemfile
62
+ env: DB=postgresql
39
63
  - rvm: 2.1.10
40
64
  gemfile: gemfiles/rails_42.gemfile
41
- env: DB=sqlite3
65
+ env: DB=postgresql
42
66
  - rvm: 2.0.0
43
67
  gemfile: gemfiles/rails_42.gemfile
44
- env: DB=sqlite3
68
+ env: DB=postgresql
45
69
 
46
70
  allow_failures:
47
71
  - gemfile: gemfiles/rails_edge.gemfile
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  source 'https://rubygems.org'
3
4
 
4
5
  # Specify your gem's dependencies in database_rewinder.gemspec
data/README.md CHANGED
@@ -23,9 +23,9 @@ This strategy was originally devised and implemented by Shingo Morita (@eudoxa)
23
23
 
24
24
  ## Supported versions
25
25
 
26
- * ActiveRecord 4.0, 4.1, 4.2, 5.0, 5.1, 5.2 (edge)
26
+ * ActiveRecord 4.0, 4.1, 4.2, 5.0, 5.1, 5.2, 6.0, 6.1, 7.0 (edge)
27
27
 
28
- * Ruby 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6 (trunk)
28
+ * Ruby 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0, 3.1 (trunk)
29
29
 
30
30
  ## Installation
31
31
 
@@ -98,7 +98,7 @@ In cases of this situation, bundle database\_rewinder and add the following conf
98
98
 
99
99
  ```ruby
100
100
  RSpec.configure do |config|
101
- config.use_transactional_examples = false
101
+ config.use_transactional_tests = false
102
102
 
103
103
  ...
104
104
  end
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'bundler'
3
4
  require 'bundler/setup'
4
5
  require "bundler/gem_tasks"
@@ -1,11 +1,12 @@
1
1
  # coding: utf-8
2
2
  # frozen_string_literal: true
3
+
3
4
  lib = File.expand_path('../lib', __FILE__)
4
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
6
 
6
7
  Gem::Specification.new do |spec|
7
8
  spec.name = "database_rewinder"
8
- spec.version = '0.9.0'
9
+ spec.version = '0.9.5'
9
10
  spec.authors = ["Akira Matsuda"]
10
11
  spec.email = ["ronnie@dio.jp"]
11
12
  spec.description = "A minimalist's tiny and ultra-fast database cleaner"
@@ -18,7 +19,7 @@ Gem::Specification.new do |spec|
18
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
20
  spec.require_paths = ["lib"]
20
21
 
21
- spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency 'bundler'
22
23
  spec.add_development_dependency "rake"
23
24
  spec.add_development_dependency 'test-unit-rails'
24
25
  spec.add_development_dependency 'rails'
@@ -3,6 +3,7 @@ source 'https://rubygems.org'
3
3
  gem 'rails', '~> 4.0.0'
4
4
  gem 'pg', '~> 0.21'
5
5
  gem 'mysql2', '~> 0.3.10'
6
+ gem 'sqlite3', '< 1.4'
6
7
  gem 'nokogiri', RUBY_VERSION < '2.1' ? '~> 1.6.0' : '>= 1.7'
7
8
 
8
9
  gemspec path: '../'
@@ -3,6 +3,7 @@ source 'https://rubygems.org'
3
3
  gem 'rails', '~> 4.1.0'
4
4
  gem 'pg', '~> 0.21'
5
5
  gem 'mysql2', '~> 0.3.13'
6
+ gem 'sqlite3', '< 1.4'
6
7
  gem 'nokogiri', RUBY_VERSION < '2.1' ? '~> 1.6.0' : '>= 1.7'
7
8
 
8
9
  gemspec path: '../'
@@ -3,6 +3,7 @@ source 'https://rubygems.org'
3
3
  gem 'rails', '~> 4.2.0'
4
4
  gem 'pg', '~> 0.21'
5
5
  gem 'mysql2', '~> 0.4.0'
6
+ gem 'sqlite3', '< 1.4'
6
7
  gem 'nokogiri', RUBY_VERSION < '2.1' ? '~> 1.6.0' : '>= 1.7'
7
8
 
8
9
  gemspec path: '../'
@@ -2,5 +2,6 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'rails', '~> 5.0.0'
4
4
  gem 'pg', '~> 0.21'
5
+ gem 'sqlite3', '< 1.4'
5
6
 
6
7
  gemspec path: '../'
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rails', '~> 5.2.0'
3
+ gem 'rails', '~> 5.2.0', git: 'https://github.com/rails/rails', branch: '5-2-stable'
4
4
  gem 'pg', '~> 0.21'
5
5
 
6
6
  gemspec path: '../'
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', '~> 6.0.0'
4
+ gem 'selenium-webdriver'
5
+
6
+ gemspec path: '../'
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', '~> 6.1.0'
4
+ gem 'selenium-webdriver'
5
+
6
+ gemspec path: '../'
@@ -4,6 +4,7 @@ git_source(:github) do |repo_name|
4
4
  "https://github.com/#{repo_name}.git"
5
5
  end
6
6
 
7
- gem 'rails', github: 'rails/rails'
7
+ gem 'rails', github: 'rails/rails', branch: 'main'
8
+ gem 'selenium-webdriver'
8
9
 
9
10
  gemspec path: '../'
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require_relative 'database_rewinder/cleaner'
3
2
 
4
3
  module DatabaseRewinder
5
4
  VERSION = Gem.loaded_specs['database_rewinder'].version.to_s
@@ -17,7 +16,7 @@ module DatabaseRewinder
17
16
  end
18
17
 
19
18
  def create_cleaner(connection_name)
20
- config = database_configuration[connection_name] or raise %Q[Database configuration named "#{connection_name}" is not configured.]
19
+ config = configuration_hash_for(connection_name) or raise %Q[Database configuration named "#{connection_name}" is not configured.]
21
20
 
22
21
  Cleaner.new(config: config, connection_name: connection_name, only: @only, except: @except).tap {|c| @cleaners << c}
23
22
  end
@@ -49,7 +48,7 @@ module DatabaseRewinder
49
48
  end or return
50
49
 
51
50
  sql.split(';').each do |statement|
52
- match = statement.match(/\A\s*INSERT(?:\s+IGNORE)?(?:\s+INTO)?\s+(?:\.*[`"]?([^.\s`"]+)[`"]?)*/i)
51
+ match = statement.match(/\A\s*INSERT(?:\s+IGNORE)?(?:\s+INTO)?\s+(?:\.*[`"]?([^.\s`"(]+)[`"]?)*/i)
53
52
  next unless match
54
53
 
55
54
  table = match[1]
@@ -74,7 +73,7 @@ module DatabaseRewinder
74
73
 
75
74
  # cache AR connection.tables
76
75
  def all_table_names(connection)
77
- cache_key = connection.pool.spec.config
76
+ cache_key = get_cache_key(connection.pool)
78
77
  #NOTE connection.tables warns on AR 5 with some adapters
79
78
  tables = ActiveSupport::Deprecation.silence { connection.tables }
80
79
  @table_names_cache[cache_key] ||= tables.reject do |t|
@@ -82,7 +81,32 @@ module DatabaseRewinder
82
81
  (ActiveRecord::Base.respond_to?(:internal_metadata_table_name) && (t == ActiveRecord::Base.internal_metadata_table_name))
83
82
  end
84
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.configuration_hash
88
+ else
89
+ connection_pool.spec.config
90
+ end
91
+ end
92
+
93
+ def configuration_hash_for(connection_name)
94
+ if database_configuration.respond_to?(:configs_for)
95
+ hash_config = database_configuration.configs_for(env_name: connection_name).first
96
+ if hash_config
97
+ if hash_config.respond_to?(:configuration_hash)
98
+ hash_config.configuration_hash.stringify_keys
99
+ else
100
+ hash_config.config
101
+ end
102
+ end
103
+ else
104
+ database_configuration[connection_name]
105
+ end
106
+ end
85
107
  end
108
+
109
+ private_class_method :configuration_hash_for, :get_cache_key
86
110
  end
87
111
 
88
112
  begin
@@ -91,4 +115,5 @@ begin
91
115
  rescue LoadError
92
116
  DatabaseRewinder.init
93
117
  require_relative 'database_rewinder/active_record_monkey'
118
+ require_relative 'database_rewinder/cleaner'
94
119
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module DatabaseRewinder
3
4
  module InsertRecorder
4
5
  def execute(sql, *)
@@ -6,9 +7,16 @@ module DatabaseRewinder
6
7
  super
7
8
  end
8
9
 
9
- def exec_query(sql, *)
10
- DatabaseRewinder.record_inserted_table self, sql
11
- super
10
+ if ActiveRecord::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
12
20
  end
13
21
  end
14
22
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative 'multiple_statements_executor'
3
4
 
4
5
  using DatabaseRewinder::MultipleStatementsExecutor
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module DatabaseRewinder
3
4
  module Compatibility
4
- def clean_with(*args)
5
- cleaners.each {|c| c.clean_with(*args)}
5
+ def clean_with(*args, **opts)
6
+ cleaners.each {|c| c.clean_with(*args, **opts)}
6
7
  end
7
8
 
8
9
  def cleaning
@@ -35,7 +36,7 @@ module DatabaseRewinder
35
36
  # DatabaseRewinder[:active_record, connection: 'the_db_name']
36
37
  #
37
38
  # You can cleanup multiple databases for each test using this configuration.
38
- def [](orm, connection: nil, **)
39
+ def [](orm = nil, connection: nil, **)
39
40
  if connection.nil?
40
41
  if orm.is_a? String
41
42
  connection = orm
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module DatabaseRewinder
3
4
  class DummyModel < ActiveRecord::Base
4
5
  class << self
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module DatabaseRewinder
3
4
  module MultipleStatementsExecutor
4
5
  refine ActiveRecord::ConnectionAdapters::AbstractAdapter do
@@ -1,10 +1,13 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module DatabaseRewinder
3
4
  class Railtie < ::Rails::Railtie
4
5
  initializer 'database_rewinder', after: 'active_record.initialize_database' do
5
6
  ActiveSupport.on_load :active_record do
6
7
  DatabaseRewinder.init
7
8
  require_relative 'active_record_monkey'
9
+
10
+ require_relative 'cleaner'
8
11
  end
9
12
  end
10
13
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'test_helper'
3
4
 
4
5
  class DatabaseRewinder::InsertRecorderTest < ActiveSupport::TestCase
data/test/cleaner_test.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'test_helper'
3
4
 
4
5
  class DatabaseRewinder::CleanerTest < ActiveSupport::TestCase
@@ -1,45 +1,44 @@
1
- sqlite3: &sqlite3
1
+ <% case ENV['DB']
2
+ when 'sqlite3' %>
3
+ test:
2
4
  adapter: sqlite3
3
5
  database: db/database_rewinder_test.sqlite3
4
6
  pool: 5
5
7
  timeout: 5000
6
8
 
7
- sqlite3_2: &sqlite3_2
9
+ test2:
8
10
  adapter: sqlite3
9
11
  database: db/database_rewinder_test2.sqlite3
10
12
  pool: 5
11
13
  timeout: 5000
12
14
 
13
- mysql: &mysql
15
+ <% when 'mysql' %>
16
+ test:
14
17
  adapter: mysql2
15
18
  host: localhost
16
19
  username: root
17
20
  password:
18
21
  database: database_rewinder_test
19
22
 
20
- mysql_2: &mysql_2
23
+ test2:
21
24
  adapter: mysql2
22
25
  host: localhost
23
26
  username: root
24
27
  password:
25
28
  database: database_rewinder_test2
26
29
 
27
- postgresql: &postgresql
30
+ <% when 'postgresql' %>
31
+ test:
28
32
  adapter: postgresql
29
33
  host: localhost
30
34
  username: postgres
31
35
  password:
32
36
  database: database_rewinder_test
33
37
 
34
- postgresql_2: &postgresql_2
38
+ test2:
35
39
  adapter: postgresql
36
40
  host: localhost
37
41
  username: postgres
38
42
  password:
39
43
  database: database_rewinder_test2
40
-
41
- test:
42
- <<: *<%= ENV['DB'] %>
43
-
44
- test2:
45
- <<: *<%= "#{ENV['DB']}_2" %>
44
+ <% end %>
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'test_helper'
3
4
 
4
5
  class DatabaseRewinder::DatabaseRewinderTest < ActiveSupport::TestCase
@@ -75,6 +76,25 @@ class DatabaseRewinder::DatabaseRewinderTest < ActiveSupport::TestCase
75
76
  DatabaseRewinder.database_configuration = nil
76
77
  end
77
78
 
79
+ sub_test_case 'via General Active Record insertions' do
80
+ setup do
81
+ DatabaseRewinder.cleaners
82
+ @cleaner = DatabaseRewinder.instance_variable_get(:'@cleaners').detect {|c| c.db == (ENV['DB'] == 'sqlite3' ? 'db/database_rewinder_test.sqlite3' : 'database_rewinder_test')}
83
+ end
84
+
85
+ test 'create' do
86
+ Bar.create name: 'bar1'
87
+ assert_equal ['bars'], @cleaner.inserted_tables
88
+ end
89
+
90
+ if ActiveRecord::VERSION::STRING >= '6'
91
+ test 'insert_all' do
92
+ Bar.insert_all! [{name: 'bar1'}]
93
+ assert_equal ['bars'], @cleaner.inserted_tables
94
+ end
95
+ end
96
+ end
97
+
78
98
  sub_test_case 'common database' do
79
99
  test 'include database name' do
80
100
  perform_insert 'INSERT INTO "database"."foos" ("name") VALUES (?)'
@@ -94,6 +114,10 @@ class DatabaseRewinder::DatabaseRewinderTest < ActiveSupport::TestCase
94
114
  SQL
95
115
  assert_equal ['foos'], @cleaner.inserted_tables
96
116
  end
117
+ test 'without spaces between table name and columns list' do
118
+ perform_insert 'INSERT INTO foos(name) VALUES (?)'
119
+ assert_equal ['foos'], @cleaner.inserted_tables
120
+ end
97
121
 
98
122
  test 'with multi statement query' do
99
123
  perform_insert <<-SQL
@@ -159,7 +183,7 @@ class DatabaseRewinder::DatabaseRewinderTest < ActiveSupport::TestCase
159
183
  @except = @cleaner.instance_variable_get(:@except)
160
184
  Foo.create! name: 'foo1'
161
185
  Bar.create! name: 'bar1'
162
- DatabaseRewinder.clean_with :truncation, options
186
+ DatabaseRewinder.clean_with :truncation, **options
163
187
  end
164
188
 
165
189
  test 'with only option' do
data/test/fake_app.rb CHANGED
@@ -17,30 +17,30 @@ load 'active_record/railties/databases.rake'
17
17
 
18
18
  require 'active_record/base'
19
19
  ActiveRecord::Tasks::DatabaseTasks.root ||= Rails.root
20
- ActiveRecord::Tasks::DatabaseTasks.drop_current ENV['DB']
21
- ActiveRecord::Tasks::DatabaseTasks.drop_current "#{ENV['DB']}_2"
22
- ActiveRecord::Tasks::DatabaseTasks.create_current ENV['DB']
23
- ActiveRecord::Tasks::DatabaseTasks.create_current "#{ENV['DB']}_2"
20
+ ActiveRecord::Tasks::DatabaseTasks.drop_current 'test'
21
+ ActiveRecord::Tasks::DatabaseTasks.drop_current 'test2'
22
+ ActiveRecord::Tasks::DatabaseTasks.create_current 'test'
23
+ ActiveRecord::Tasks::DatabaseTasks.create_current 'test2'
24
24
 
25
25
  # models
26
26
  class Foo < ActiveRecord::Base; end
27
27
  class Bar < ActiveRecord::Base; end
28
28
  class Baz < ActiveRecord::Base; end
29
29
  class Quu < ActiveRecord::Base
30
- establish_connection "#{ENV['DB']}_2".to_sym
30
+ establish_connection :test2
31
31
  end
32
32
 
33
33
  # migrations
34
34
  class CreateAllTables < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
35
35
  def self.up
36
- ActiveRecord::Base.establish_connection ENV['DB'].to_sym
37
- create_table(:bars) {|t| t.string :name }
36
+ ActiveRecord::Base.establish_connection :test
37
+ create_table(:bars) {|t| t.string :name; t.index :name, unique: true }
38
38
  create_table(:foos) {|t| t.string :name; t.references :bar, foreign_key: true }
39
39
  create_table(:bazs) {|t| t.string :name }
40
40
 
41
- test2_connection = ActiveRecord::Base.establish_connection("#{ENV['DB']}_2".to_sym).connection
41
+ test2_connection = ActiveRecord::Base.establish_connection(:test2).connection
42
42
  test2_connection.create_table(:quus) {|t| t.string :name }
43
- ActiveRecord::Base.establish_connection ENV['DB'].to_sym
43
+ ActiveRecord::Base.establish_connection :test
44
44
  end
45
45
 
46
46
  def self.down
@@ -48,8 +48,8 @@ class CreateAllTables < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migrat
48
48
  drop_table(:bars) {|t| t.string :name }
49
49
  drop_table(:bazs) {|t| t.string :name }
50
50
 
51
- test2_connection = ActiveRecord::Base.establish_connection("#{ENV['DB']}_2".to_sym).connection
51
+ test2_connection = ActiveRecord::Base.establish_connection(:test2).connection
52
52
  test2_connection.drop_table :quus
53
- ActiveRecord::Base.establish_connection ENV['DB'].to_sym
53
+ ActiveRecord::Base.establish_connection :test
54
54
  end
55
55
  end
data/test/test_helper.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  ENV['RAILS_ENV'] ||= 'test'
3
4
 
4
5
  $LOAD_PATH.unshift(File.join(__dir__, '..', 'lib'))
@@ -9,6 +10,10 @@ require 'active_record'
9
10
  require 'database_rewinder'
10
11
  require 'fake_app'
11
12
  require 'test/unit/rails/test_help'
13
+ begin
14
+ require 'selenium/webdriver' # rails 6
15
+ rescue LoadError
16
+ end
12
17
 
13
18
  migrated = ActiveRecord::Base.connection.respond_to?(:data_source_exists?) ? ActiveRecord::Base.connection.data_source_exists?('foos') : ActiveRecord::Base.connection.table_exists?('foos')
14
19
  CreateAllTables.up unless migrated
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: database_rewinder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira Matsuda
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-15 00:00:00.000000000 Z
11
+ date: 2021-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.3'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.3'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -128,6 +128,8 @@ files:
128
128
  - gemfiles/rails_50.gemfile
129
129
  - gemfiles/rails_51.gemfile
130
130
  - gemfiles/rails_52.gemfile
131
+ - gemfiles/rails_60.gemfile
132
+ - gemfiles/rails_61.gemfile
131
133
  - gemfiles/rails_edge.gemfile
132
134
  - lib/database_rewinder.rb
133
135
  - lib/database_rewinder/active_record_monkey.rb
@@ -147,7 +149,7 @@ homepage: https://github.com/amatsuda/database_rewinder
147
149
  licenses:
148
150
  - MIT
149
151
  metadata: {}
150
- post_install_message:
152
+ post_install_message:
151
153
  rdoc_options: []
152
154
  require_paths:
153
155
  - lib
@@ -162,9 +164,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
164
  - !ruby/object:Gem::Version
163
165
  version: '0'
164
166
  requirements: []
165
- rubyforge_project:
166
- rubygems_version: 2.7.7
167
- signing_key:
167
+ rubygems_version: 3.3.0.dev
168
+ signing_key:
168
169
  specification_version: 4
169
170
  summary: A minimalist's tiny and ultra-fast database cleaner
170
171
  test_files: