database_cleaner 0.8.0 → 0.9.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.
- data/Gemfile.lock +150 -82
- data/History.txt +19 -1
- data/README.textile +61 -59
- data/Rakefile +7 -17
- data/VERSION.yml +3 -3
- data/examples/Gemfile +14 -20
- data/examples/Gemfile.lock +150 -82
- data/examples/features/step_definitions/translation_steps.rb +14 -14
- data/examples/features/support/env.rb +6 -2
- data/features/cleaning.feature +1 -1
- data/features/cleaning_default_strategy.feature +1 -1
- data/features/cleaning_multiple_dbs.feature +1 -2
- data/features/cleaning_multiple_orms.feature +7 -7
- data/features/support/env.rb +1 -1
- data/lib/database_cleaner/active_record/base.rb +26 -6
- data/lib/database_cleaner/active_record/deletion.rb +2 -2
- data/lib/database_cleaner/active_record/transaction.rb +9 -9
- data/lib/database_cleaner/active_record/truncation.rb +157 -50
- data/lib/database_cleaner/base.rb +2 -2
- data/lib/database_cleaner/configuration.rb +26 -3
- data/lib/database_cleaner/data_mapper/truncation.rb +2 -2
- data/lib/database_cleaner/generic/truncation.rb +7 -5
- data/lib/database_cleaner/mongo/base.rb +16 -0
- data/lib/database_cleaner/mongo/truncation.rb +9 -14
- data/lib/database_cleaner/mongo/truncation_mixin.rb +22 -0
- data/lib/database_cleaner/mongo_mapper/truncation.rb +2 -2
- data/lib/database_cleaner/mongoid/truncation.rb +2 -2
- data/lib/database_cleaner/moped/truncation.rb +6 -2
- data/lib/database_cleaner/sequel/truncation.rb +6 -6
- data/spec/database_cleaner/active_record/base_spec.rb +27 -15
- data/spec/database_cleaner/active_record/truncation/mysql2_spec.rb +40 -0
- data/spec/database_cleaner/active_record/truncation/mysql_spec.rb +40 -0
- data/spec/database_cleaner/active_record/truncation/postgresql_spec.rb +48 -0
- data/spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb +40 -0
- data/spec/database_cleaner/active_record/truncation_spec.rb +102 -33
- data/spec/database_cleaner/base_spec.rb +14 -14
- data/spec/database_cleaner/configuration_spec.rb +15 -10
- data/spec/database_cleaner/data_mapper/base_spec.rb +1 -1
- data/spec/database_cleaner/data_mapper/transaction_spec.rb +1 -1
- data/spec/database_cleaner/data_mapper/truncation_spec.rb +1 -1
- data/spec/database_cleaner/generic/base_spec.rb +1 -1
- data/spec/database_cleaner/generic/truncation_spec.rb +35 -5
- data/spec/database_cleaner/mongo/mongo_examples.rb +26 -0
- data/spec/database_cleaner/mongo/truncation_spec.rb +72 -0
- data/spec/database_cleaner/mongo_mapper/base_spec.rb +1 -1
- data/spec/database_cleaner/sequel/base_spec.rb +1 -1
- data/spec/database_cleaner/sequel/transaction_spec.rb +1 -1
- data/spec/database_cleaner/sequel/truncation_spec.rb +1 -1
- data/spec/database_cleaner/{shared_strategy_spec.rb → shared_strategy.rb} +0 -0
- data/spec/spec_helper.rb +6 -4
- data/spec/support/active_record/database_setup.rb +4 -0
- data/spec/support/active_record/mysql2_setup.rb +38 -0
- data/spec/support/active_record/mysql_setup.rb +38 -0
- data/spec/support/active_record/postgresql_setup.rb +41 -0
- data/spec/support/active_record/schema_setup.rb +10 -0
- metadata +313 -46
- data/spec/spec.opts +0 -7
data/Rakefile
CHANGED
@@ -19,25 +19,15 @@ rescue LoadError
|
|
19
19
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
20
20
|
end
|
21
21
|
|
22
|
-
require '
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
27
|
-
rdoc.rdoc_files.include('README*')
|
28
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
22
|
+
require 'rspec/core'
|
23
|
+
require 'rspec/core/rake_task'
|
24
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
25
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
29
26
|
end
|
30
27
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
35
|
-
end
|
36
|
-
|
37
|
-
Spec::Rake::SpecTask.new(:rcov) do |t|
|
38
|
-
t.libs << 'lib' << 'spec'
|
39
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
40
|
-
t.rcov = true
|
28
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
29
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
30
|
+
spec.rcov = true
|
41
31
|
end
|
42
32
|
|
43
33
|
begin
|
data/VERSION.yml
CHANGED
data/examples/Gemfile
CHANGED
@@ -1,18 +1,5 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
|
-
#
|
3
|
-
# # gem "mysql"
|
4
|
-
# # gem "json_pure", "1.4.3"
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# # gem "datamapper", "1.0.0"
|
8
|
-
# # gem "dm-migrations", "1.0.0"
|
9
|
-
# # gem "dm-sqlite-adapter", "1.0.0"
|
10
|
-
#
|
11
|
-
# # mongo requirements
|
12
|
-
# # gem "mongo", "1.0.1"
|
13
|
-
# # gem "mongo_ext", "0.19.3"
|
14
|
-
# # gem "bson_ext", "1.0.1"
|
15
|
-
# end
|
2
|
+
# TODO: move these to the gemspec...
|
16
3
|
|
17
4
|
group :development do
|
18
5
|
gem "rake"
|
@@ -24,20 +11,27 @@ group :development do
|
|
24
11
|
gem "json_pure"
|
25
12
|
|
26
13
|
#ORM's
|
27
|
-
gem "activerecord"
|
14
|
+
gem "activerecord"
|
28
15
|
gem "datamapper", "1.0.0"
|
29
16
|
gem "dm-migrations", "1.0.0"
|
30
17
|
gem "dm-sqlite-adapter", "1.0.0"
|
31
|
-
gem "mongoid"
|
32
|
-
gem "tzinfo"
|
33
|
-
|
34
|
-
|
18
|
+
gem "mongoid"
|
19
|
+
gem "tzinfo"
|
20
|
+
gem "mongo_ext"
|
21
|
+
gem "bson_ext"
|
22
|
+
gem "mongo_mapper"
|
23
|
+
gem "couch_potato"
|
35
24
|
gem "sequel", "~>3.21.0"
|
36
25
|
#gem "ibm_db" # I don't want to add this dependency, even as a dev one since it requires DB2 to be installed
|
26
|
+
gem 'mysql'
|
27
|
+
gem 'mysql2'
|
28
|
+
gem 'pg'
|
29
|
+
|
30
|
+
gem 'guard-rspec'
|
37
31
|
end
|
38
32
|
|
39
33
|
group :test do
|
40
|
-
gem "rspec"
|
34
|
+
gem "rspec-rails"
|
41
35
|
gem "rspactor"
|
42
36
|
gem "rcov"
|
43
37
|
gem "ZenTest"
|
data/examples/Gemfile.lock
CHANGED
@@ -1,28 +1,49 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
ZenTest (4.
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
4
|
+
ZenTest (4.8.1)
|
5
|
+
actionpack (3.2.6)
|
6
|
+
activemodel (= 3.2.6)
|
7
|
+
activesupport (= 3.2.6)
|
8
|
+
builder (~> 3.0.0)
|
9
|
+
erubis (~> 2.7.0)
|
10
|
+
journey (~> 1.0.1)
|
11
|
+
rack (~> 1.4.0)
|
12
|
+
rack-cache (~> 1.2)
|
13
|
+
rack-test (~> 0.6.1)
|
14
|
+
sprockets (~> 2.1.3)
|
15
|
+
activemodel (3.2.6)
|
16
|
+
activesupport (= 3.2.6)
|
17
|
+
builder (~> 3.0.0)
|
18
|
+
activerecord (3.2.6)
|
19
|
+
activemodel (= 3.2.6)
|
20
|
+
activesupport (= 3.2.6)
|
21
|
+
arel (~> 3.0.2)
|
22
|
+
tzinfo (~> 0.3.29)
|
23
|
+
activesupport (3.2.6)
|
24
|
+
i18n (~> 0.6)
|
25
|
+
multi_json (~> 1.0)
|
26
|
+
addressable (2.2.8)
|
27
|
+
arel (3.0.2)
|
28
|
+
bson (1.6.4)
|
29
|
+
bson_ext (1.6.4)
|
30
|
+
bson (~> 1.6.4)
|
31
|
+
builder (3.0.0)
|
32
|
+
columnize (0.3.6)
|
33
|
+
couch_potato (0.5.7)
|
34
|
+
activemodel
|
35
|
+
couchrest (>= 1.0.1)
|
14
36
|
json
|
15
37
|
couchrest (1.0.1)
|
16
38
|
json (>= 1.4.6)
|
17
39
|
mime-types (>= 1.15)
|
18
40
|
rest-client (>= 1.5.1)
|
19
|
-
cucumber (
|
20
|
-
builder (
|
21
|
-
diff-lcs (
|
22
|
-
gherkin (~> 2.
|
23
|
-
|
24
|
-
|
25
|
-
data_objects (0.10.2)
|
41
|
+
cucumber (1.2.1)
|
42
|
+
builder (>= 2.1.2)
|
43
|
+
diff-lcs (>= 1.1.3)
|
44
|
+
gherkin (~> 2.11.0)
|
45
|
+
json (>= 1.4.6)
|
46
|
+
data_objects (0.10.8)
|
26
47
|
addressable (~> 2.1)
|
27
48
|
datamapper (1.0.0)
|
28
49
|
dm-aggregates (= 1.0.0)
|
@@ -35,7 +56,7 @@ GEM
|
|
35
56
|
dm-transactions (= 1.0.0)
|
36
57
|
dm-types (= 1.0.0)
|
37
58
|
dm-validations (= 1.0.0)
|
38
|
-
diff-lcs (1.1.
|
59
|
+
diff-lcs (1.1.3)
|
39
60
|
dm-aggregates (1.0.0)
|
40
61
|
dm-core (~> 1.0.0)
|
41
62
|
dm-constraints (1.0.0)
|
@@ -68,96 +89,143 @@ GEM
|
|
68
89
|
uuidtools (~> 2.1.1)
|
69
90
|
dm-validations (1.0.0)
|
70
91
|
dm-core (~> 1.0.0)
|
71
|
-
do_sqlite3 (0.10.
|
72
|
-
data_objects (= 0.10.
|
73
|
-
|
92
|
+
do_sqlite3 (0.10.8)
|
93
|
+
data_objects (= 0.10.8)
|
94
|
+
erubis (2.7.0)
|
74
95
|
extlib (0.9.15)
|
75
|
-
fastercsv (1.5.
|
76
|
-
ffi (
|
77
|
-
|
78
|
-
|
79
|
-
gherkin (2.1.5)
|
80
|
-
trollop (~> 1.16.2)
|
96
|
+
fastercsv (1.5.5)
|
97
|
+
ffi (1.1.4)
|
98
|
+
gherkin (2.11.1)
|
99
|
+
json (>= 1.4.6)
|
81
100
|
git (1.2.5)
|
82
|
-
|
83
|
-
|
84
|
-
|
101
|
+
guard (1.3.0)
|
102
|
+
listen (>= 0.4.2)
|
103
|
+
thor (>= 0.14.6)
|
104
|
+
guard-rspec (1.2.1)
|
105
|
+
guard (>= 1.1)
|
106
|
+
hike (1.2.1)
|
107
|
+
i18n (0.6.0)
|
108
|
+
jeweler (1.8.4)
|
109
|
+
bundler (~> 1.0)
|
85
110
|
git (>= 1.2.5)
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
json (1.
|
111
|
+
rake
|
112
|
+
rdoc
|
113
|
+
journey (1.0.4)
|
114
|
+
json (1.7.3)
|
90
115
|
json_pure (1.4.6)
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
116
|
+
linecache (0.46)
|
117
|
+
rbx-require-relative (> 0.0.4)
|
118
|
+
listen (0.4.7)
|
119
|
+
rb-fchange (~> 0.0.5)
|
120
|
+
rb-fsevent (~> 0.9.1)
|
121
|
+
rb-inotify (~> 0.8.8)
|
122
|
+
mime-types (1.19)
|
123
|
+
mongo (1.6.4)
|
124
|
+
bson (~> 1.6.4)
|
125
|
+
mongo_ext (0.19.3)
|
126
|
+
mongo_mapper (0.11.1)
|
127
|
+
activemodel (~> 3.0)
|
128
|
+
activesupport (~> 3.0)
|
129
|
+
plucky (~> 0.4.0)
|
130
|
+
mongoid (3.0.1)
|
131
|
+
activemodel (~> 3.1)
|
132
|
+
moped (~> 1.1.1)
|
133
|
+
origin (~> 1.0.3)
|
134
|
+
tzinfo (~> 0.3.22)
|
135
|
+
moped (1.1.2)
|
136
|
+
multi_json (1.3.6)
|
137
|
+
mysql (2.8.1)
|
138
|
+
mysql2 (0.3.11)
|
139
|
+
origin (1.0.4)
|
140
|
+
pg (0.14.0)
|
141
|
+
plucky (0.4.4)
|
142
|
+
mongo (~> 1.5)
|
143
|
+
rack (1.4.1)
|
144
|
+
rack-cache (1.2)
|
145
|
+
rack (>= 0.4)
|
146
|
+
rack-ssl (1.3.2)
|
147
|
+
rack
|
148
|
+
rack-test (0.6.1)
|
149
|
+
rack (>= 1.0)
|
150
|
+
railties (3.2.6)
|
151
|
+
actionpack (= 3.2.6)
|
152
|
+
activesupport (= 3.2.6)
|
153
|
+
rack-ssl (~> 1.3.2)
|
154
|
+
rake (>= 0.8.7)
|
155
|
+
rdoc (~> 3.4)
|
156
|
+
thor (>= 0.14.6, < 2.0)
|
157
|
+
rake (0.9.2.2)
|
158
|
+
rb-fchange (0.0.5)
|
159
|
+
ffi
|
160
|
+
rb-fsevent (0.9.1)
|
161
|
+
rb-inotify (0.8.8)
|
111
162
|
ffi (>= 0.5.0)
|
112
|
-
|
113
|
-
|
163
|
+
rbx-require-relative (0.0.9)
|
164
|
+
rcov (1.0.0)
|
165
|
+
rdoc (3.12)
|
166
|
+
json (~> 1.4)
|
167
|
+
rest-client (1.6.7)
|
114
168
|
mime-types (>= 1.16)
|
115
|
-
rspactor (0.
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
169
|
+
rspactor (0.6.4)
|
170
|
+
rspec (2.11.0)
|
171
|
+
rspec-core (~> 2.11.0)
|
172
|
+
rspec-expectations (~> 2.11.0)
|
173
|
+
rspec-mocks (~> 2.11.0)
|
174
|
+
rspec-core (2.11.1)
|
175
|
+
rspec-expectations (2.11.1)
|
176
|
+
diff-lcs (~> 1.1.3)
|
177
|
+
rspec-mocks (2.11.1)
|
178
|
+
rspec-rails (2.11.0)
|
179
|
+
actionpack (>= 3.0)
|
180
|
+
activesupport (>= 3.0)
|
181
|
+
railties (>= 3.0)
|
182
|
+
rspec (~> 2.11.0)
|
183
|
+
ruby-debug (0.10.4)
|
124
184
|
columnize (>= 0.1)
|
125
|
-
ruby-debug-base (~> 0.10.
|
126
|
-
ruby-debug-base (0.10.
|
185
|
+
ruby-debug-base (~> 0.10.4.0)
|
186
|
+
ruby-debug-base (0.10.4)
|
127
187
|
linecache (>= 0.3)
|
128
|
-
rubyforge (2.0.4)
|
129
|
-
json_pure (>= 1.1.7)
|
130
188
|
sequel (3.21.0)
|
131
|
-
|
189
|
+
sprockets (2.1.3)
|
190
|
+
hike (~> 1.2)
|
191
|
+
rack (~> 1.0)
|
192
|
+
tilt (~> 1.1, != 1.3.0)
|
193
|
+
sqlite3 (1.3.6)
|
194
|
+
sqlite3-ruby (1.3.3)
|
195
|
+
sqlite3 (>= 1.3.3)
|
132
196
|
stringex (1.1.0)
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
uuidtools (2.1.1)
|
138
|
-
will_paginate (2.3.14)
|
197
|
+
thor (0.15.4)
|
198
|
+
tilt (1.3.3)
|
199
|
+
tzinfo (0.3.33)
|
200
|
+
uuidtools (2.1.3)
|
139
201
|
|
140
202
|
PLATFORMS
|
141
203
|
ruby
|
142
204
|
|
143
205
|
DEPENDENCIES
|
144
206
|
ZenTest
|
145
|
-
activerecord
|
207
|
+
activerecord
|
208
|
+
bson_ext
|
146
209
|
bundler
|
147
|
-
couch_potato
|
210
|
+
couch_potato
|
148
211
|
cucumber
|
149
212
|
datamapper (= 1.0.0)
|
150
213
|
dm-migrations (= 1.0.0)
|
151
214
|
dm-sqlite-adapter (= 1.0.0)
|
215
|
+
guard-rspec
|
152
216
|
jeweler
|
153
217
|
json_pure
|
154
|
-
|
155
|
-
|
218
|
+
mongo_ext
|
219
|
+
mongo_mapper
|
220
|
+
mongoid
|
221
|
+
mysql
|
222
|
+
mysql2
|
223
|
+
pg
|
156
224
|
rake
|
157
225
|
rcov
|
158
226
|
rspactor
|
159
|
-
rspec
|
227
|
+
rspec-rails
|
160
228
|
ruby-debug
|
161
229
|
sequel (~> 3.21.0)
|
162
230
|
sqlite3-ruby
|
163
|
-
tzinfo
|
231
|
+
tzinfo
|
@@ -1,55 +1,55 @@
|
|
1
1
|
When /^I create a widget$/ do
|
2
|
-
|
2
|
+
step "I create a widget using #{ENV['ORM'].downcase}"
|
3
3
|
end
|
4
4
|
|
5
5
|
Then /^I should see 1 widget$/ do
|
6
|
-
|
6
|
+
step "I should see 1 widget using #{ENV['ORM'].downcase}"
|
7
7
|
end
|
8
8
|
|
9
9
|
When /^I create a widget in one orm$/ do
|
10
|
-
|
10
|
+
step "I create a widget using #{ENV['ORM'].downcase}"
|
11
11
|
end
|
12
12
|
|
13
13
|
When /^I create a widget in another orm$/ do
|
14
|
-
|
14
|
+
step "I create a widget using #{ENV['ANOTHER_ORM'].downcase}"
|
15
15
|
end
|
16
16
|
|
17
17
|
Then /^I should see 1 widget in one orm$/ do
|
18
|
-
|
18
|
+
step "I should see 1 widget using #{ENV['ORM'].downcase}"
|
19
19
|
end
|
20
20
|
|
21
21
|
Then /^I should see 1 widget in another orm$/ do
|
22
|
-
|
22
|
+
step "I should see 1 widget using #{ENV['ANOTHER_ORM'].downcase}"
|
23
23
|
end
|
24
24
|
|
25
25
|
Then /^I should see 0 widget in another orm$/ do
|
26
|
-
|
26
|
+
step "I should see 0 widget using #{ENV['ANOTHER_ORM'].downcase}"
|
27
27
|
end
|
28
28
|
|
29
29
|
Then /^I should see 0 widget in one orm$/ do
|
30
|
-
|
30
|
+
step "I should see 0 widget using #{ENV['ORM'].downcase}"
|
31
31
|
end
|
32
32
|
|
33
33
|
When /^I create a widget in one db$/ do
|
34
|
-
|
34
|
+
step "I create a widget in one db using #{ENV['ORM'].downcase}"
|
35
35
|
end
|
36
36
|
|
37
37
|
When /^I create a widget in another db$/ do
|
38
|
-
|
38
|
+
step "I create a widget in another db using #{ENV['ORM'].downcase}"
|
39
39
|
end
|
40
40
|
|
41
41
|
Then /^I should see 1 widget in one db$/ do
|
42
|
-
|
42
|
+
step "I should see 1 widget in one db using #{ENV['ORM'].downcase}"
|
43
43
|
end
|
44
44
|
|
45
45
|
Then /^I should see 1 widget in another db$/ do
|
46
|
-
|
46
|
+
step "I should see 1 widget in another db using #{ENV['ORM'].downcase}"
|
47
47
|
end
|
48
48
|
|
49
49
|
Then /^I should see 0 widget in another db$/ do
|
50
|
-
|
50
|
+
step "I should see 0 widget in another db using #{ENV['ORM'].downcase}"
|
51
51
|
end
|
52
52
|
|
53
53
|
Then /^I should see 0 widget in one db$/ do
|
54
|
-
|
54
|
+
step "I should see 0 widget in one db using #{ENV['ORM'].downcase}"
|
55
55
|
end
|