database_rewinder 0.8.0 → 0.8.1
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 +4 -4
- data/.travis.yml +15 -13
- data/README.md +3 -3
- data/database_rewinder.gemspec +1 -1
- data/gemfiles/rails_40.gemfile +1 -0
- data/gemfiles/rails_41.gemfile +1 -0
- data/gemfiles/rails_42.gemfile +1 -0
- data/gemfiles/rails_51.gemfile +5 -0
- data/gemfiles/rails_edge.gemfile +5 -0
- data/lib/database_rewinder.rb +2 -2
- data/test/database_rewinder_test.rb +6 -0
- data/test/fake_app.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c72cae523f6afdb28ee8e3416cb89822ee1abf2
|
4
|
+
data.tar.gz: 23b6abd160c797cc3c63a93c28f61d09cce4e650
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fd241c1d0ccdfe677e97c611402d19e1cda5e5262759e45219f97a2b467fa0ea94433d582a940ba8bd1b52b06ef480ab2e19fd0aa34d2131d2a6d78162c8ee1
|
7
|
+
data.tar.gz: 720ee1316305dc464cb5459edbc004e2deafd7c48fa51a577a72a2086d7182482eb238b692cf3082a3c75dbfb37bd116b81320c4b5a65ea668ef074bb38d26fb
|
data/.travis.yml
CHANGED
@@ -8,27 +8,29 @@ env:
|
|
8
8
|
- DB=postgresql
|
9
9
|
|
10
10
|
rvm:
|
11
|
-
- 2.
|
12
|
-
- 2.
|
13
|
-
- 2.
|
14
|
-
- 2.3.3
|
11
|
+
- 2.2.7
|
12
|
+
- 2.3.4
|
13
|
+
- 2.4.1
|
15
14
|
|
16
15
|
gemfile:
|
17
|
-
- gemfiles/rails_40.gemfile
|
18
|
-
- gemfiles/rails_41.gemfile
|
19
16
|
- gemfiles/rails_42.gemfile
|
20
17
|
- gemfiles/rails_50.gemfile
|
18
|
+
- gemfiles/rails_51.gemfile
|
21
19
|
- gemfiles/rails_edge.gemfile
|
22
20
|
|
23
21
|
sudo: false
|
24
22
|
|
25
23
|
matrix:
|
26
|
-
|
27
|
-
- rvm: 2.
|
28
|
-
gemfile: gemfiles/
|
24
|
+
include:
|
25
|
+
- rvm: 2.3.4
|
26
|
+
gemfile: gemfiles/rails_41.gemfile
|
27
|
+
env: DB=sqlite3
|
28
|
+
- rvm: 2.3.4
|
29
|
+
gemfile: gemfiles/rails_40.gemfile
|
30
|
+
env: DB=sqlite3
|
29
31
|
- rvm: 2.1.10
|
30
|
-
gemfile: gemfiles/
|
32
|
+
gemfile: gemfiles/rails_42.gemfile
|
33
|
+
env: DB=sqlite3
|
31
34
|
- rvm: 2.0.0
|
32
|
-
gemfile: gemfiles/
|
33
|
-
|
34
|
-
gemfile: gemfiles/rails_50.gemfile
|
35
|
+
gemfile: gemfiles/rails_42.gemfile
|
36
|
+
env: DB=sqlite3
|
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
|
26
|
+
* ActiveRecord 4.0, 4.1, 4.2, 5.0, 5.1, 5.2 (edge)
|
27
27
|
|
28
|
-
* Ruby 2.0, 2.1, 2.2, 2.3
|
28
|
+
* Ruby 2.0, 2.1, 2.2, 2.3, 2.4
|
29
29
|
|
30
30
|
## Installation
|
31
31
|
|
@@ -105,7 +105,7 @@ end
|
|
105
105
|
```
|
106
106
|
|
107
107
|
#### 2. Cleaning with `multiple: false` option
|
108
|
-
If you're really sure you need to keep using
|
108
|
+
If you're really sure you need to keep using transactional tests + database\_rewinder for some reason, then explicitly pass in `multiple: false` option to `DatabaseRewinder.clean_all` and `DatabaseRewinder.clean` invocations as follows. Note that you won't be able to get full performance merit that database\_rewinder provides though.
|
109
109
|
|
110
110
|
```ruby
|
111
111
|
RSpec.configure do |config|
|
data/database_rewinder.gemspec
CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "database_rewinder"
|
8
|
-
spec.version = '0.8.
|
8
|
+
spec.version = '0.8.1'
|
9
9
|
spec.authors = ["Akira Matsuda"]
|
10
10
|
spec.email = ["ronnie@dio.jp"]
|
11
11
|
spec.description = "A minimalist's tiny and ultra-fast database cleaner"
|
data/gemfiles/rails_40.gemfile
CHANGED
data/gemfiles/rails_41.gemfile
CHANGED
data/gemfiles/rails_42.gemfile
CHANGED
data/gemfiles/rails_edge.gemfile
CHANGED
@@ -1,5 +1,10 @@
|
|
1
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
|
2
6
|
|
3
7
|
gem 'rails', github: 'rails/rails'
|
8
|
+
gem 'arel', github: 'rails/arel'
|
4
9
|
|
5
10
|
gemspec path: '../'
|
data/lib/database_rewinder.rb
CHANGED
@@ -48,7 +48,7 @@ module DatabaseRewinder
|
|
48
48
|
end
|
49
49
|
end or return
|
50
50
|
|
51
|
-
match = sql.match(/\
|
51
|
+
match = sql.match(/\A\s*INSERT(?:\s+IGNORE)?(?:\s+INTO)?\s+(?:\.*[`"]?([^.\s`"]+)[`"]?)*/i)
|
52
52
|
return unless match
|
53
53
|
|
54
54
|
table = match[1]
|
@@ -76,7 +76,7 @@ module DatabaseRewinder
|
|
76
76
|
#NOTE connection.tables warns on AR 5 with some adapters
|
77
77
|
tables = ActiveSupport::Deprecation.silence { connection.tables }
|
78
78
|
@table_names_cache[cache_key] ||= tables.reject do |t|
|
79
|
-
(t == ActiveRecord::
|
79
|
+
(t == ActiveRecord::SchemaMigration.table_name) ||
|
80
80
|
(ActiveRecord::Base.respond_to?(:internal_metadata_table_name) && (t == ActiveRecord::Base.internal_metadata_table_name))
|
81
81
|
end
|
82
82
|
end
|
@@ -88,6 +88,12 @@ class DatabaseRewinder::DatabaseRewinderTest < ActiveSupport::TestCase
|
|
88
88
|
perform_insert 'INSERT "foos" ("name") VALUES (?)'
|
89
89
|
assert_equal ['foos'], @cleaner.inserted_tables
|
90
90
|
end
|
91
|
+
test 'with space before "INSERT"' do
|
92
|
+
perform_insert <<-SQL
|
93
|
+
INSERT INTO "foos" ("name") VALUES (?)
|
94
|
+
SQL
|
95
|
+
assert_equal ['foos'], @cleaner.inserted_tables
|
96
|
+
end
|
91
97
|
end
|
92
98
|
|
93
99
|
sub_test_case 'Database accepts more than one dots in an object notation (e.g. SQLServer)' do
|
data/test/fake_app.rb
CHANGED
@@ -29,7 +29,7 @@ class Quu < ActiveRecord::Base
|
|
29
29
|
end
|
30
30
|
|
31
31
|
# migrations
|
32
|
-
class CreateAllTables < ActiveRecord::Migration
|
32
|
+
class CreateAllTables < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
|
33
33
|
def self.up
|
34
34
|
ActiveRecord::Base.establish_connection ENV['DB'].to_sym
|
35
35
|
create_table(:bars) {|t| t.string :name }
|
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.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akira Matsuda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -126,6 +126,7 @@ files:
|
|
126
126
|
- gemfiles/rails_41.gemfile
|
127
127
|
- gemfiles/rails_42.gemfile
|
128
128
|
- gemfiles/rails_50.gemfile
|
129
|
+
- gemfiles/rails_51.gemfile
|
129
130
|
- gemfiles/rails_edge.gemfile
|
130
131
|
- lib/database_rewinder.rb
|
131
132
|
- lib/database_rewinder/active_record_monkey.rb
|
@@ -161,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
162
|
version: '0'
|
162
163
|
requirements: []
|
163
164
|
rubyforge_project:
|
164
|
-
rubygems_version: 2.
|
165
|
+
rubygems_version: 2.6.11
|
165
166
|
signing_key:
|
166
167
|
specification_version: 4
|
167
168
|
summary: A minimalist's tiny and ultra-fast database cleaner
|