database_rewinder 0.9.6 → 0.9.7

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: cdfa4a22f839cc429f7334f0c175a8f51a1c398e67cb10ebe831f9ba18761fed
4
- data.tar.gz: f7bc66b8f216587fdc6af220a5033d973c6da09c2035a0c63c8a5741b31c5fd4
3
+ metadata.gz: 3faca08aeeb413648502e9d1f981e3588602c1a16443c5c5eb5761eacc87958b
4
+ data.tar.gz: cb98bb919d0385f4a0fb576f3ce5be2a563d51d68f86925fe23496413d17d0ac
5
5
  SHA512:
6
- metadata.gz: 83b2df863231cef40e644e8a6e567862842bb630cbebd965769a19e365c23dd1877675c548e81150e797b95e8f069bc5b45119c3f7186944d44cd9f889c42ed8
7
- data.tar.gz: 34aa414d520248f0989087acb94d1e2c01f861c84baceb6cfa89c8bbb424018374fc75e261d52e18d651e994a25ae62e2ed447215f8cbd81b19ae729e7de301d
6
+ metadata.gz: d9319fdd90028c57093eba269657626af32dde21253a068949d20b325179f92749e1ad28953175c9a2c3805745167425cccb152aab689bf4811f2beb5ea88a29
7
+ data.tar.gz: cb93c0847c649a3dfbace111dd3c5082c5950c95db7c4f31adbc6161daa0d2ff373e13f772b2e234293179a8ddc94e9c61021cadfea55c8fd9c40661ca1c2ef0
@@ -0,0 +1,111 @@
1
+ name: build
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ services:
8
+ postgres:
9
+ image: postgres:10
10
+ env:
11
+ POSTGRES_USER: postgres
12
+ POSTGRES_PASSWORD: postgres
13
+ ports:
14
+ - 5432:5432
15
+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
16
+ mysql:
17
+ image: mysql:5.7
18
+ env:
19
+ MYSQL_ROOT_PASSWORD:
20
+ MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
21
+ ports:
22
+ - 3306:3306
23
+ options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10
24
+
25
+ strategy:
26
+ fail-fast: false
27
+
28
+ matrix:
29
+ db: [sqlite3, postgresql, mysql]
30
+ ruby_version: [ruby-head, '3.0', '2.7', '2.6']
31
+ rails_version: [edge, '7.0', '6.1', '6.0', '5.2']
32
+
33
+ exclude:
34
+ - ruby_version: '2.6'
35
+ rails_version: edge
36
+
37
+ - ruby_version: '2.6'
38
+ rails_version: '7.0'
39
+
40
+ - ruby_version: ruby-head
41
+ rails_version: '6.1'
42
+
43
+ - ruby_version: ruby-head
44
+ rails_version: '6.0'
45
+ - ruby_version: '3.0'
46
+ rails_version: '6.0'
47
+
48
+ - ruby_version: ruby-head
49
+ rails_version: '5.2'
50
+ - ruby_version: '3.0'
51
+ rails_version: '5.2'
52
+
53
+ include:
54
+ - ruby_version: '2.4'
55
+ rails_version: '5.2'
56
+ db: sqlite3
57
+ - ruby_version: '2.4'
58
+ rails_version: '5.2'
59
+ db: postgresql
60
+ - ruby_version: '2.4'
61
+ rails_version: '5.2'
62
+ db: mysql
63
+
64
+ - ruby_version: '2.6'
65
+ rails_version: '5.1'
66
+ db: sqlite3
67
+ - ruby_version: '2.6'
68
+ rails_version: '5.1'
69
+ db: postgresql
70
+ - ruby_version: '2.6'
71
+ rails_version: '5.1'
72
+ db: mysql
73
+
74
+ - ruby_version: '2.5'
75
+ rails_version: '5.0'
76
+ db: sqlite3
77
+ - ruby_version: '2.5'
78
+ rails_version: '5.0'
79
+ db: postgresql
80
+ - ruby_version: '2.5'
81
+ rails_version: '5.0'
82
+ db: mysql
83
+
84
+ - ruby_version: '2.4'
85
+ rails_version: '4.2'
86
+ db: sqlite3
87
+ - ruby_version: '2.4'
88
+ rails_version: '4.2'
89
+ db: postgresql
90
+ - ruby_version: '2.4'
91
+ rails_version: '4.2'
92
+ db: mysql
93
+
94
+ runs-on: ubuntu-18.04
95
+
96
+ env:
97
+ RAILS_VERSION: ${{ matrix.rails_version }}
98
+ DB: ${{ matrix.db }}
99
+
100
+ steps:
101
+ - uses: actions/checkout@v2
102
+
103
+ - uses: ruby/setup-ruby@v1
104
+ with:
105
+ ruby-version: ${{ matrix.ruby_version }}
106
+ bundler: ${{ startsWith(matrix.rails_version, '4.') && '1' || 'latest' }}
107
+ bundler-cache: true
108
+ continue-on-error: ${{ (matrix.ruby_version == 'ruby-head') || (matrix.allow_failures == 'true') }}
109
+
110
+ - run: bundle exec rake
111
+ continue-on-error: ${{ (matrix.ruby_version == 'ruby-head') || (matrix.rails_version == 'edge') || (matrix.allow_failures == 'true') }}
data/Gemfile CHANGED
@@ -4,3 +4,31 @@ source 'https://rubygems.org'
4
4
 
5
5
  # Specify your gem's dependencies in database_rewinder.gemspec
6
6
  gemspec
7
+
8
+ if ENV['RAILS_VERSION'] == 'edge'
9
+ gem 'rails', git: 'https://github.com/rails/rails.git'
10
+ elsif ENV['RAILS_VERSION']
11
+ gem 'rails', "~> #{ENV['RAILS_VERSION']}.0"
12
+ else
13
+ gem 'rails'
14
+ end
15
+
16
+ gem 'nokogiri', RUBY_VERSION < '2.1' ? '~> 1.6.0' : '>= 1.7'
17
+ gem 'selenium-webdriver'
18
+
19
+ rails_version = ENV['RAILS_VERSION'] || '∞'
20
+
21
+ case ENV['DB']
22
+ when 'postgresql'
23
+ gem 'pg', rails_version <= '5.2' ? '~> 0.21' : '>= 1'
24
+ when 'mysql'
25
+ if rails_version <= '4.1'
26
+ gem 'mysql2', '~> 0.3.13'
27
+ elsif rails_version <= '4.2'
28
+ gem 'mysql2', '~> 0.4.0'
29
+ else
30
+ gem 'mysql2'
31
+ end
32
+ else
33
+ gem 'sqlite3', rails_version <= '5.0' ? '< 1.4' : '>= 1.4'
34
+ end
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # DatabaseRewinder
2
2
 
3
- [![Build Status](https://travis-ci.org/amatsuda/database_rewinder.svg)](http://travis-ci.org/amatsuda/database\_rewinder)
3
+ [![Build Status](https://github.com/amatsuda/database_rewinder/actions/workflows/main.yml/badge.svg)](https://github.com/amatsuda/database_rewinder/actions)
4
4
 
5
5
  database\_rewinder is a minimalist's tiny and ultra-fast database cleaner.
6
6
 
@@ -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, 6.0, 6.1, 7.0 (edge)
26
+ * ActiveRecord 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, 2.7, 3.0, 3.1 (trunk)
28
+ * Ruby 2.4, 2.5, 2.6, 2.7, 3.0, 3.1 (trunk)
29
29
 
30
30
  ## Installation
31
31
 
@@ -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.6'
9
+ spec.version = '0.9.7'
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 for Active Record"
@@ -23,8 +23,5 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "rake"
24
24
  spec.add_development_dependency 'test-unit-rails'
25
25
  spec.add_development_dependency 'rails'
26
- spec.add_development_dependency 'sqlite3'
27
- spec.add_development_dependency 'mysql2'
28
- spec.add_development_dependency 'pg'
29
26
  spec.required_ruby_version = '>= 2.0.0'
30
27
  end
@@ -15,6 +15,11 @@ module DatabaseRewinder
15
15
  DatabaseRewinder.record_inserted_table self, sql
16
16
  super
17
17
  end
18
+
19
+ def raw_execute(sql, *, **)
20
+ DatabaseRewinder.record_inserted_table self, sql
21
+ super
22
+ end
18
23
  end
19
24
  end
20
25
 
@@ -114,7 +114,7 @@ module DatabaseRewinder
114
114
  end
115
115
 
116
116
  def multiple_database_configuration_for(connection_name)
117
- if (ActiveRecord::VERSION::MAJOR >= 6) && (ActiveRecord::VERSION::MINOR >= 1)
117
+ if (ActiveRecord::VERSION::MAJOR >= 7) || ((ActiveRecord::VERSION::MAJOR >= 6) && (ActiveRecord::VERSION::MINOR >= 1))
118
118
  database_configuration.configs_for(name: connection_name)
119
119
  else
120
120
  database_configuration.configs_for(spec_name: connection_name)
@@ -15,14 +15,14 @@ test2:
15
15
  <% when 'mysql' %>
16
16
  test:
17
17
  adapter: mysql2
18
- host: localhost
18
+ host: 127.0.0.1
19
19
  username: root
20
20
  password:
21
21
  database: database_rewinder_test
22
22
 
23
23
  test2:
24
24
  adapter: mysql2
25
- host: localhost
25
+ host: 127.0.0.1
26
26
  username: root
27
27
  password:
28
28
  database: database_rewinder_test2
@@ -31,14 +31,15 @@ test2:
31
31
  test:
32
32
  adapter: postgresql
33
33
  host: localhost
34
+ # this user has to be a superuser for the tests to pass
34
35
  username: postgres
35
- password:
36
+ password: postgres
36
37
  database: database_rewinder_test
37
38
 
38
39
  test2:
39
40
  adapter: postgresql
40
41
  host: localhost
41
42
  username: postgres
42
- password:
43
+ password: postgres
43
44
  database: database_rewinder_test2
44
45
  <% end %>
data/test/fake_app.rb CHANGED
@@ -10,11 +10,13 @@ module DatabaseRewinderTestApp
10
10
 
11
11
  config.eager_load = false
12
12
  config.active_support.deprecation = :log
13
+
14
+ rake_tasks do
15
+ load 'active_record/railties/databases.rake'
16
+ end
13
17
  end.initialize!
14
18
  end
15
19
 
16
- load 'active_record/railties/databases.rake'
17
-
18
20
  require 'active_record/base'
19
21
  ActiveRecord::Tasks::DatabaseTasks.root ||= Rails.root
20
22
  ActiveRecord::Tasks::DatabaseTasks.drop_current 'test'
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.6
4
+ version: 0.9.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira Matsuda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-31 00:00:00.000000000 Z
11
+ date: 2022-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,48 +66,6 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: sqlite3
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: mysql2
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: pg
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
69
  description: A minimalist's tiny and ultra-fast database cleaner for Active Record
112
70
  email:
113
71
  - ronnie@dio.jp
@@ -115,22 +73,13 @@ executables: []
115
73
  extensions: []
116
74
  extra_rdoc_files: []
117
75
  files:
76
+ - ".github/workflows/main.yml"
118
77
  - ".gitignore"
119
- - ".travis.yml"
120
78
  - Gemfile
121
79
  - MIT_LICENSE
122
80
  - README.md
123
81
  - Rakefile
124
82
  - database_rewinder.gemspec
125
- - gemfiles/rails_40.gemfile
126
- - gemfiles/rails_41.gemfile
127
- - gemfiles/rails_42.gemfile
128
- - gemfiles/rails_50.gemfile
129
- - gemfiles/rails_51.gemfile
130
- - gemfiles/rails_52.gemfile
131
- - gemfiles/rails_60.gemfile
132
- - gemfiles/rails_61.gemfile
133
- - gemfiles/rails_edge.gemfile
134
83
  - lib/database_rewinder.rb
135
84
  - lib/database_rewinder/active_record_monkey.rb
136
85
  - lib/database_rewinder/cleaner.rb
@@ -164,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
113
  - !ruby/object:Gem::Version
165
114
  version: '0'
166
115
  requirements: []
167
- rubygems_version: 3.2.15
116
+ rubygems_version: 3.3.3
168
117
  signing_key:
169
118
  specification_version: 4
170
119
  summary: A minimalist's tiny and ultra-fast database cleaner
data/.travis.yml DELETED
@@ -1,90 +0,0 @@
1
- language: ruby
2
-
3
- addons:
4
- postgresql: '9.4'
5
- mysql: '5.7'
6
-
7
- before_install:
8
- # install older versions of rubygems and bundler only on Ruby < 2.7
9
- - if [ "${TRAVIS_RUBY_VERSION}" != "ruby-head" ] && [ `echo "${TRAVIS_RUBY_VERSION:0:3} < 2.7" | bc` == 1 ]; then gem i rubygems-update -v '<3' && update_rubygems; fi;
10
- - if [ "${TRAVIS_RUBY_VERSION}" != "ruby-head" ] && [ `echo "${TRAVIS_RUBY_VERSION:0:3} < 2.7" | bc` == 1 ]; then gem i bundler -v '<2'; fi;
11
- - sudo service mysql restart
12
-
13
-
14
- cache: bundler
15
-
16
- env:
17
- matrix:
18
- - DB=sqlite3
19
- - DB=mysql
20
- - DB=postgresql
21
-
22
- rvm:
23
- - 2.7.3
24
-
25
- gemfile:
26
- - gemfiles/rails_52.gemfile
27
- - gemfiles/rails_60.gemfile
28
- - gemfiles/rails_61.gemfile
29
-
30
- sudo: false
31
-
32
- dist: xenial
33
-
34
- matrix:
35
- include:
36
- - rvm: ruby-head
37
- gemfile: gemfiles/rails_edge.gemfile
38
- env: DB=postgresql
39
- - rvm: ruby-head
40
- gemfile: gemfiles/rails_61.gemfile
41
- env: DB=postgresql
42
- - rvm: 3.0.1
43
- gemfile: gemfiles/rails_edge.gemfile
44
- env: DB=postgresql
45
- - rvm: 3.0.1
46
- gemfile: gemfiles/rails_edge.gemfile
47
- env: DB=mysql
48
- - rvm: 3.0.1
49
- gemfile: gemfiles/rails_edge.gemfile
50
- env: DB=sqlite3
51
- - rvm: 3.0.1
52
- gemfile: gemfiles/rails_61.gemfile
53
- env: DB=postgresql
54
- - rvm: 3.0.1
55
- gemfile: gemfiles/rails_61.gemfile
56
- env: DB=mysql
57
- - rvm: 3.0.1
58
- gemfile: gemfiles/rails_61.gemfile
59
- env: DB=sqlite3
60
- - rvm: 2.6.7
61
- gemfile: gemfiles/rails_60.gemfile
62
- env: DB=postgresql
63
- - rvm: 2.6.7
64
- gemfile: gemfiles/rails_52.gemfile
65
- env: DB=postgresql
66
- - rvm: 2.5.9
67
- gemfile: gemfiles/rails_51.gemfile
68
- env: DB=postgresql
69
- - rvm: 2.4.10
70
- gemfile: gemfiles/rails_50.gemfile
71
- env: DB=postgresql
72
- - rvm: 2.3.8
73
- gemfile: gemfiles/rails_41.gemfile
74
- env: DB=postgresql
75
- - rvm: 2.3.8
76
- gemfile: gemfiles/rails_40.gemfile
77
- env: DB=postgresql
78
- - rvm: 2.2.10
79
- gemfile: gemfiles/rails_52.gemfile
80
- env: DB=postgresql
81
- - rvm: 2.1.10
82
- gemfile: gemfiles/rails_42.gemfile
83
- env: DB=postgresql
84
- - rvm: 2.0.0
85
- gemfile: gemfiles/rails_42.gemfile
86
- env: DB=postgresql
87
-
88
- allow_failures:
89
- - rvm: ruby-head
90
- - gemfile: gemfiles/rails_edge.gemfile
@@ -1,9 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 4.0.0'
4
- gem 'pg', '~> 0.21'
5
- gem 'mysql2', '~> 0.3.10'
6
- gem 'sqlite3', '< 1.4'
7
- gem 'nokogiri', RUBY_VERSION < '2.1' ? '~> 1.6.0' : '>= 1.7'
8
-
9
- gemspec path: '../'
@@ -1,9 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 4.1.0'
4
- gem 'pg', '~> 0.21'
5
- gem 'mysql2', '~> 0.3.13'
6
- gem 'sqlite3', '< 1.4'
7
- gem 'nokogiri', RUBY_VERSION < '2.1' ? '~> 1.6.0' : '>= 1.7'
8
-
9
- gemspec path: '../'
@@ -1,9 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 4.2.0'
4
- gem 'pg', '~> 0.21'
5
- gem 'mysql2', '~> 0.4.0'
6
- gem 'sqlite3', '< 1.4'
7
- gem 'nokogiri', RUBY_VERSION < '2.1' ? '~> 1.6.0' : '>= 1.7'
8
-
9
- gemspec path: '../'
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 5.0.0'
4
- gem 'pg', '~> 0.21'
5
- gem 'sqlite3', '< 1.4'
6
-
7
- gemspec path: '../'
@@ -1,8 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 5.1.0'
4
- gem 'pg', '~> 0.21'
5
- gem 'capybara', '~> 2.13'
6
- gem 'puma'
7
-
8
- gemspec path: '../'
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 5.2.0', git: 'https://github.com/rails/rails', branch: '5-2-stable'
4
- gem 'pg', '~> 0.21'
5
-
6
- gemspec path: '../'
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 6.0.0'
4
- gem 'selenium-webdriver'
5
-
6
- gemspec path: '../'
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 6.1.0'
4
- gem 'selenium-webdriver'
5
-
6
- gemspec path: '../'
@@ -1,10 +0,0 @@
1
- source 'https://rubygems.org'
2
- git_source(:github) do |repo_name|
3
- repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
4
- "https://github.com/#{repo_name}.git"
5
- end
6
-
7
- gem 'rails', github: 'rails/rails', branch: 'main'
8
- gem 'selenium-webdriver'
9
-
10
- gemspec path: '../'