database_cleaner 0.6.7 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/database_cleaner.rb +1 -3
- metadata +48 -154
- data/Gemfile.lock +0 -161
- data/History.txt +0 -173
- data/LICENSE +0 -20
- data/README.textile +0 -165
- data/Rakefile +0 -65
- data/TODO +0 -3
- data/VERSION.yml +0 -5
- data/cucumber.yml +0 -1
- data/examples/Gemfile +0 -48
- data/examples/Gemfile.lock +0 -161
- data/examples/config/database.yml.example +0 -8
- data/examples/db/sqlite_databases_go_here +0 -0
- data/examples/features/example.feature +0 -11
- data/examples/features/example_multiple_db.feature +0 -23
- data/examples/features/example_multiple_orm.feature +0 -22
- data/examples/features/step_definitions/activerecord_steps.rb +0 -31
- data/examples/features/step_definitions/couchpotato_steps.rb +0 -31
- data/examples/features/step_definitions/datamapper_steps.rb +0 -37
- data/examples/features/step_definitions/mongoid_steps.rb +0 -23
- data/examples/features/step_definitions/mongomapper_steps.rb +0 -31
- data/examples/features/step_definitions/translation_steps.rb +0 -55
- data/examples/features/support/env.rb +0 -62
- data/examples/lib/activerecord_models.rb +0 -41
- data/examples/lib/couchpotato_models.rb +0 -61
- data/examples/lib/datamapper_models.rb +0 -50
- data/examples/lib/mongoid_models.rb +0 -49
- data/examples/lib/mongomapper_models.rb +0 -51
- data/features/cleaning.feature +0 -22
- data/features/cleaning_default_strategy.feature +0 -19
- data/features/cleaning_multiple_dbs.feature +0 -21
- data/features/cleaning_multiple_orms.feature +0 -29
- data/features/step_definitions/database_cleaner_steps.rb +0 -32
- data/features/support/env.rb +0 -7
- data/features/support/feature_runner.rb +0 -39
- data/lib/database_cleaner/active_record/#transaction.rb# +0 -34
- data/lib/database_cleaner/active_record/base.rb +0 -53
- data/lib/database_cleaner/active_record/deletion.rb +0 -64
- data/lib/database_cleaner/active_record/transaction.rb +0 -26
- data/lib/database_cleaner/active_record/truncation.rb +0 -134
- data/lib/database_cleaner/base.rb +0 -136
- data/lib/database_cleaner/configuration.rb +0 -92
- data/lib/database_cleaner/couch_potato/base.rb +0 -7
- data/lib/database_cleaner/couch_potato/truncation.rb +0 -28
- data/lib/database_cleaner/cucumber.rb +0 -11
- data/lib/database_cleaner/data_mapper/base.rb +0 -21
- data/lib/database_cleaner/data_mapper/transaction.rb +0 -28
- data/lib/database_cleaner/data_mapper/truncation.rb +0 -175
- data/lib/database_cleaner/generic/base.rb +0 -23
- data/lib/database_cleaner/generic/truncation.rb +0 -43
- data/lib/database_cleaner/mongo/truncation.rb +0 -22
- data/lib/database_cleaner/mongo_mapper/base.rb +0 -20
- data/lib/database_cleaner/mongo_mapper/truncation.rb +0 -19
- data/lib/database_cleaner/mongoid/base.rb +0 -20
- data/lib/database_cleaner/mongoid/truncation.rb +0 -20
- data/lib/database_cleaner/null_strategy.rb +0 -15
- data/spec/database_cleaner/active_record/base_spec.rb +0 -141
- data/spec/database_cleaner/active_record/transaction_spec.rb +0 -65
- data/spec/database_cleaner/active_record/truncation_spec.rb +0 -82
- data/spec/database_cleaner/base_spec.rb +0 -478
- data/spec/database_cleaner/configuration_spec.rb +0 -294
- data/spec/database_cleaner/couch_potato/truncation_spec.rb +0 -41
- data/spec/database_cleaner/data_mapper/base_spec.rb +0 -30
- data/spec/database_cleaner/data_mapper/transaction_spec.rb +0 -23
- data/spec/database_cleaner/data_mapper/truncation_spec.rb +0 -11
- data/spec/database_cleaner/generic/base_spec.rb +0 -22
- data/spec/database_cleaner/generic/truncation_spec.rb +0 -78
- data/spec/database_cleaner/mongo_mapper/base_spec.rb +0 -33
- data/spec/database_cleaner/mongo_mapper/mongo_examples.rb +0 -8
- data/spec/database_cleaner/mongo_mapper/truncation_spec.rb +0 -74
- data/spec/database_cleaner/shared_strategy_spec.rb +0 -13
- data/spec/rcov.opts +0 -1
- data/spec/spec.opts +0 -7
- data/spec/spec_helper.rb +0 -19
data/README.textile
DELETED
@@ -1,165 +0,0 @@
|
|
1
|
-
h1. Database Cleaner
|
2
|
-
|
3
|
-
Database Cleaner is a set of strategies for cleaning your database in Ruby.
|
4
|
-
The original use case was to ensure a clean state during tests. Each strategy
|
5
|
-
is a small amount of code but is code that is usually needed in any ruby app
|
6
|
-
that is testing with a database.
|
7
|
-
|
8
|
-
ActiveRecord, DataMapper, MongoMapper, Mongoid, and CouchPotato are supported.
|
9
|
-
|
10
|
-
Here is an overview of the strategies supported for each library:
|
11
|
-
|
12
|
-
|_. ORM |_. Truncation |_. Transaction |_. Deletion |
|
13
|
-
| ActiveRecord | Yes | **Yes** | Yes |
|
14
|
-
| DataMapper | Yes | **Yes** | No |
|
15
|
-
| CouchPotato | **Yes** | No | No |
|
16
|
-
| MongoMapper | **Yes** | No | No |
|
17
|
-
| Mongoid | **Yes** | No | No |
|
18
|
-
|
19
|
-
(Default strategy for each library is denoted in bold)
|
20
|
-
|
21
|
-
The ActiveRecord @:deletion@ strategy is only useful for when the @:truncation@ strategy causes
|
22
|
-
locks (as reported by some Oracle DB users). The @:truncation@ strategy is the preferred option
|
23
|
-
since it is much faster.
|
24
|
-
|
25
|
-
Database Cleaner also includes a @null@ strategy (that does no cleaning at all) which can be used
|
26
|
-
with any ORM library. You can also explicitly use it by setting your strategy to @nil@.
|
27
|
-
|
28
|
-
h2. How to use
|
29
|
-
|
30
|
-
<pre>
|
31
|
-
require 'database_cleaner'
|
32
|
-
DatabaseCleaner.strategy = :truncation
|
33
|
-
|
34
|
-
# then, whenever you need to clean the DB
|
35
|
-
DatabaseCleaner.clean
|
36
|
-
</pre>
|
37
|
-
|
38
|
-
With the :truncation strategy you can also pass in options, for example:
|
39
|
-
<pre>
|
40
|
-
DatabaseCleaner.strategy = :truncation, {:only => %w[widgets dogs some_other_table]}
|
41
|
-
</pre>
|
42
|
-
|
43
|
-
<pre>
|
44
|
-
DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]}
|
45
|
-
</pre>
|
46
|
-
|
47
|
-
(I should point out the truncation strategy will never truncate your schema_migrations table.)
|
48
|
-
|
49
|
-
Some strategies require that you call DatabaseCleaner.start before calling clean
|
50
|
-
(for example the :transaction one needs to know to open up a transaction). So
|
51
|
-
you would have:
|
52
|
-
|
53
|
-
<pre>
|
54
|
-
require 'database_cleaner'
|
55
|
-
DatabaseCleaner.strategy = :transaction
|
56
|
-
|
57
|
-
DatabaseCleaner.start # usually this is called in setup of a test
|
58
|
-
dirty_the_db
|
59
|
-
DatabaseCleaner.clean # cleanup of the test
|
60
|
-
</pre>
|
61
|
-
|
62
|
-
At times you may want to do a single clean with one strategy. For example, you may want
|
63
|
-
to start the process by truncating all the tables, but then use the faster transaction
|
64
|
-
strategy the remaining time. To accomplish this you can say:
|
65
|
-
|
66
|
-
<pre>
|
67
|
-
require 'database_cleaner'
|
68
|
-
DatabaseCleaner.clean_with :truncation
|
69
|
-
DatabaseCleaner.strategy = :transaction
|
70
|
-
# then make the DatabaseCleaner.start and DatabaseCleaner.clean calls appropriately
|
71
|
-
</pre>
|
72
|
-
|
73
|
-
Example usage with RSpec:
|
74
|
-
|
75
|
-
<pre>
|
76
|
-
Spec::Runner.configure do |config|
|
77
|
-
|
78
|
-
config.before(:suite) do
|
79
|
-
DatabaseCleaner.strategy = :transaction
|
80
|
-
DatabaseCleaner.clean_with(:truncation)
|
81
|
-
end
|
82
|
-
|
83
|
-
config.before(:each) do
|
84
|
-
DatabaseCleaner.start
|
85
|
-
end
|
86
|
-
|
87
|
-
config.after(:each) do
|
88
|
-
DatabaseCleaner.clean
|
89
|
-
end
|
90
|
-
|
91
|
-
end
|
92
|
-
</pre>
|
93
|
-
|
94
|
-
For use in Cucumber please see the section below.
|
95
|
-
|
96
|
-
In rare cases DatabaseCleaner will encounter errors that it will log. By default it uses STDOUT set to the ERROR level but you can configure this to use whatever Logger you desire. Here's an example of using the Rails.logger in env.rb:
|
97
|
-
|
98
|
-
<pre>
|
99
|
-
DatabaseCleaner.logger = Rails.logger
|
100
|
-
</pre>
|
101
|
-
|
102
|
-
|
103
|
-
h2. How to use with multiple ORM's
|
104
|
-
|
105
|
-
Sometimes you need to use multiple ORMs in your application. You can use DatabaseCleaner to clean multiple ORMs, and multiple connections for those ORMs.
|
106
|
-
|
107
|
-
<pre>
|
108
|
-
#How to specify particular orms
|
109
|
-
DatabaseCleaner[:active_record].strategy = :transaction
|
110
|
-
DatabaseCleaner[:mongo_mapper].strategy = :truncation
|
111
|
-
|
112
|
-
#How to specify particular connections
|
113
|
-
DatabaseCleaner[:active_record,{:connection => :two}]
|
114
|
-
</pre>
|
115
|
-
|
116
|
-
Usage beyond that remains the same with DatabaseCleaner.start calling any setup on the different configured connections, and DatabaseCleaner.clean executing afterwards.
|
117
|
-
|
118
|
-
Configuration options
|
119
|
-
|
120
|
-
|
121
|
-
|_. ORM |_. How to access |_. Notes |
|
122
|
-
| Active Record | DatabaseCleaner[:active_record] | Connection specified as :symbol keys, loaded from config/database.yml |
|
123
|
-
| Data Mapper | DatabaseCleaner[:data_mapper] | Connection specified as :symbol keys, loaded via Datamapper repositories |
|
124
|
-
| Mongo Mapper | DatabaseCleaner[:mongo_mapper] | Multiple connections not yet supported |
|
125
|
-
| Mongoid | DatabaseCleaner[:mongoid] | Multiple connections not yet supported |
|
126
|
-
| Couch Potato | DatabaseCleaner[:couch_potato] | Multiple connections not yet supported |
|
127
|
-
|
128
|
-
h2. Why?
|
129
|
-
|
130
|
-
One of my motivations for writing this library was to have an easy way to
|
131
|
-
turn on what Rails calls "transactional_fixtures" in my non-rails
|
132
|
-
ActiveRecord projects. For example, Cucumber ships with a Rails world that
|
133
|
-
will wrap each scenario in a transaction. This is great, but what if you are
|
134
|
-
using ActiveRecord in a non-rails project? You used to have to copy-and-paste
|
135
|
-
the needed code, but with DatabaseCleaner you can now say:
|
136
|
-
|
137
|
-
<pre>
|
138
|
-
#env.rb
|
139
|
-
require 'database_cleaner'
|
140
|
-
require 'database_cleaner/cucumber'
|
141
|
-
DatabaseCleaner.strategy = :transaction
|
142
|
-
</pre>
|
143
|
-
|
144
|
-
Now lets say you are running your features and it requires that another process be
|
145
|
-
involved (i.e. Selenium running against your app's server.) You can simply change
|
146
|
-
your strategy type:
|
147
|
-
|
148
|
-
<pre>
|
149
|
-
#env.rb
|
150
|
-
require 'database_cleaner'
|
151
|
-
require 'database_cleaner/cucumber'
|
152
|
-
DatabaseCleaner.strategy = :truncation
|
153
|
-
</pre>
|
154
|
-
|
155
|
-
You can have the best of both worlds and use the best one for the job:
|
156
|
-
<pre>
|
157
|
-
#env.rb
|
158
|
-
require 'database_cleaner'
|
159
|
-
require 'database_cleaner/cucumber'
|
160
|
-
DatabaseCleaner.strategy = (ENV['SELENIUM'] == 'true') ? :truncation : :transaction
|
161
|
-
</pre>
|
162
|
-
|
163
|
-
h2. COPYRIGHT
|
164
|
-
|
165
|
-
Copyright (c) 2009 Ben Mabey. See LICENSE for details.
|
data/Rakefile
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
require "rubygems"
|
2
|
-
require "bundler"
|
3
|
-
Bundler.setup
|
4
|
-
|
5
|
-
require 'rake'
|
6
|
-
|
7
|
-
begin
|
8
|
-
require 'jeweler'
|
9
|
-
Jeweler::Tasks.new do |s|
|
10
|
-
s.name = "database_cleaner"
|
11
|
-
s.summary = %Q{Strategies for cleaning databases. Can be used to ensure a clean state for testing.}
|
12
|
-
s.email = "ben@benmabey.com"
|
13
|
-
s.homepage = "http://github.com/bmabey/database_cleaner"
|
14
|
-
s.description = "Strategies for cleaning databases. Can be used to ensure a clean state for testing."
|
15
|
-
s.files = FileList["[A-Z]*.*", "{examples,lib,features,spec}/**/*", "Rakefile", "cucumber.yml"]
|
16
|
-
s.authors = ["Ben Mabey"]
|
17
|
-
end
|
18
|
-
rescue LoadError
|
19
|
-
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
20
|
-
end
|
21
|
-
|
22
|
-
require 'rake/rdoctask'
|
23
|
-
Rake::RDocTask.new do |rdoc|
|
24
|
-
rdoc.rdoc_dir = 'rdoc'
|
25
|
-
rdoc.title = 'database_cleaner'
|
26
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
27
|
-
rdoc.rdoc_files.include('README*')
|
28
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
29
|
-
end
|
30
|
-
|
31
|
-
require 'spec/rake/spectask'
|
32
|
-
Spec::Rake::SpecTask.new(:spec) do |t|
|
33
|
-
t.libs << 'lib' << 'spec'
|
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
|
41
|
-
end
|
42
|
-
|
43
|
-
begin
|
44
|
-
require 'cucumber/rake/task'
|
45
|
-
Cucumber::Rake::Task.new(:features)
|
46
|
-
rescue LoadError
|
47
|
-
puts "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
|
48
|
-
end
|
49
|
-
|
50
|
-
task :default => [:spec, :features]
|
51
|
-
|
52
|
-
|
53
|
-
desc "Cleans the project of any tmp file that should not be included in the gemspec."
|
54
|
-
task :clean do
|
55
|
-
["examples/config/database.yml", "examples/db/activerecord_one.db", "examples/db/activerecord_two.db", "examples/db/datamapper_default.db",
|
56
|
-
"examples/db/datamapper_one.db", "examples/db/datamapper_two.db"].each do |f|
|
57
|
-
FileUtils.rm_f(f)
|
58
|
-
end
|
59
|
-
%w[*.sqlite3 *.log].each do |pattern|
|
60
|
-
`find . -name "#{pattern}" -delete`
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
desc "Cleans the dir and builds the gem"
|
65
|
-
task :prep => [:clean, :gemspec, :build]
|
data/TODO
DELETED
data/VERSION.yml
DELETED
data/cucumber.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
default: features
|
data/examples/Gemfile
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
source "http://rubygems.org"
|
2
|
-
# group :development do
|
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
|
16
|
-
|
17
|
-
group :development do
|
18
|
-
gem "rake"
|
19
|
-
gem "ruby-debug"
|
20
|
-
|
21
|
-
gem "bundler"
|
22
|
-
gem "jeweler"
|
23
|
-
|
24
|
-
gem "json_pure"
|
25
|
-
|
26
|
-
#ORM's
|
27
|
-
gem "activerecord", "2.3.8"
|
28
|
-
gem "datamapper", "1.0.0"
|
29
|
-
gem "dm-migrations", "1.0.0"
|
30
|
-
gem "dm-sqlite-adapter", "1.0.0"
|
31
|
-
gem "mongoid", "1.9.1"
|
32
|
-
gem "tzinfo", "0.3.22"
|
33
|
-
gem "mongo_mapper", "0.8.2"
|
34
|
-
gem "couch_potato", "0.3.0"
|
35
|
-
#gem "ibm_db" # I don't want to add this dependency, even as a dev one since it requires DB2 to be installed
|
36
|
-
end
|
37
|
-
|
38
|
-
group :test do
|
39
|
-
gem "rspec"
|
40
|
-
gem "rspactor"
|
41
|
-
gem "rcov"
|
42
|
-
gem "ZenTest"
|
43
|
-
end
|
44
|
-
|
45
|
-
group :cucumber do
|
46
|
-
gem "cucumber"
|
47
|
-
gem 'sqlite3-ruby'
|
48
|
-
end
|
data/examples/Gemfile.lock
DELETED
@@ -1,161 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
ZenTest (4.3.3)
|
5
|
-
activerecord (2.3.8)
|
6
|
-
activesupport (= 2.3.8)
|
7
|
-
activesupport (2.3.8)
|
8
|
-
addressable (2.2.0)
|
9
|
-
bson (1.0.4)
|
10
|
-
builder (2.1.2)
|
11
|
-
columnize (0.3.1)
|
12
|
-
couch_potato (0.3.0)
|
13
|
-
couchrest (>= 0.24)
|
14
|
-
json
|
15
|
-
couchrest (1.0.1)
|
16
|
-
json (>= 1.4.6)
|
17
|
-
mime-types (>= 1.15)
|
18
|
-
rest-client (>= 1.5.1)
|
19
|
-
cucumber (0.8.5)
|
20
|
-
builder (~> 2.1.2)
|
21
|
-
diff-lcs (~> 1.1.2)
|
22
|
-
gherkin (~> 2.1.4)
|
23
|
-
json_pure (~> 1.4.3)
|
24
|
-
term-ansicolor (~> 1.0.4)
|
25
|
-
data_objects (0.10.2)
|
26
|
-
addressable (~> 2.1)
|
27
|
-
datamapper (1.0.0)
|
28
|
-
dm-aggregates (= 1.0.0)
|
29
|
-
dm-constraints (= 1.0.0)
|
30
|
-
dm-core (= 1.0.0)
|
31
|
-
dm-core (= 1.0.0)
|
32
|
-
dm-migrations (= 1.0.0)
|
33
|
-
dm-serializer (= 1.0.0)
|
34
|
-
dm-timestamps (= 1.0.0)
|
35
|
-
dm-transactions (= 1.0.0)
|
36
|
-
dm-types (= 1.0.0)
|
37
|
-
dm-validations (= 1.0.0)
|
38
|
-
diff-lcs (1.1.2)
|
39
|
-
dm-aggregates (1.0.0)
|
40
|
-
dm-core (~> 1.0.0)
|
41
|
-
dm-constraints (1.0.0)
|
42
|
-
dm-core (~> 1.0.0)
|
43
|
-
dm-migrations (~> 1.0.0)
|
44
|
-
dm-core (1.0.0)
|
45
|
-
addressable (~> 2.1)
|
46
|
-
extlib (~> 0.9.15)
|
47
|
-
dm-do-adapter (1.0.0)
|
48
|
-
data_objects (~> 0.10.1)
|
49
|
-
dm-core (~> 1.0.0)
|
50
|
-
dm-migrations (1.0.0)
|
51
|
-
dm-core (~> 1.0.0)
|
52
|
-
dm-serializer (1.0.0)
|
53
|
-
dm-core (~> 1.0.0)
|
54
|
-
fastercsv (~> 1.5.3)
|
55
|
-
json_pure (~> 1.4.3)
|
56
|
-
dm-sqlite-adapter (1.0.0)
|
57
|
-
dm-do-adapter (~> 1.0.0)
|
58
|
-
do_sqlite3 (~> 0.10.2)
|
59
|
-
dm-timestamps (1.0.0)
|
60
|
-
dm-core (~> 1.0.0)
|
61
|
-
dm-transactions (1.0.0)
|
62
|
-
dm-core (~> 1.0.0)
|
63
|
-
dm-types (1.0.0)
|
64
|
-
dm-core (~> 1.0.0)
|
65
|
-
fastercsv (~> 1.5.3)
|
66
|
-
json_pure (~> 1.4.3)
|
67
|
-
stringex (~> 1.1.0)
|
68
|
-
uuidtools (~> 2.1.1)
|
69
|
-
dm-validations (1.0.0)
|
70
|
-
dm-core (~> 1.0.0)
|
71
|
-
do_sqlite3 (0.10.2)
|
72
|
-
data_objects (= 0.10.2)
|
73
|
-
durran-validatable (2.0.1)
|
74
|
-
extlib (0.9.15)
|
75
|
-
fastercsv (1.5.3)
|
76
|
-
ffi (0.6.3)
|
77
|
-
rake (>= 0.8.7)
|
78
|
-
gemcutter (0.6.1)
|
79
|
-
gherkin (2.1.5)
|
80
|
-
trollop (~> 1.16.2)
|
81
|
-
git (1.2.5)
|
82
|
-
growl (1.0.3)
|
83
|
-
jeweler (1.4.0)
|
84
|
-
gemcutter (>= 0.1.0)
|
85
|
-
git (>= 1.2.5)
|
86
|
-
rubyforge (>= 2.0.0)
|
87
|
-
jnunemaker-validatable (1.8.4)
|
88
|
-
activesupport (>= 2.3.4)
|
89
|
-
json (1.4.6)
|
90
|
-
json_pure (1.4.6)
|
91
|
-
libnotify (0.2.0)
|
92
|
-
ffi (>= 0.6.2)
|
93
|
-
linecache (0.43)
|
94
|
-
mime-types (1.16)
|
95
|
-
mongo (1.0.7)
|
96
|
-
bson (>= 1.0.4)
|
97
|
-
mongo_mapper (0.8.2)
|
98
|
-
activesupport (>= 2.3.4)
|
99
|
-
jnunemaker-validatable (~> 1.8.4)
|
100
|
-
plucky (~> 0.3.1)
|
101
|
-
mongoid (1.9.1)
|
102
|
-
activesupport (<= 3.0.0)
|
103
|
-
bson (~> 1.0.1)
|
104
|
-
durran-validatable (>= 2.0.1)
|
105
|
-
mongo (~> 1.0.1)
|
106
|
-
will_paginate (< 2.9)
|
107
|
-
plucky (0.3.4)
|
108
|
-
mongo (~> 1.0.7)
|
109
|
-
rake (0.8.7)
|
110
|
-
rb-inotify (0.8.1)
|
111
|
-
ffi (>= 0.5.0)
|
112
|
-
rcov (0.9.8)
|
113
|
-
rest-client (1.6.0)
|
114
|
-
mime-types (>= 1.16)
|
115
|
-
rspactor (0.7.0.beta.6)
|
116
|
-
bundler (>= 1.0.0.rc.5)
|
117
|
-
growl (>= 1.0.3)
|
118
|
-
libnotify (>= 0.1.3)
|
119
|
-
rb-inotify
|
120
|
-
sys-uname (>= 0.8.4)
|
121
|
-
trollop (>= 1.16.2)
|
122
|
-
rspec (1.3.0)
|
123
|
-
ruby-debug (0.10.3)
|
124
|
-
columnize (>= 0.1)
|
125
|
-
ruby-debug-base (~> 0.10.3.0)
|
126
|
-
ruby-debug-base (0.10.3)
|
127
|
-
linecache (>= 0.3)
|
128
|
-
rubyforge (2.0.4)
|
129
|
-
json_pure (>= 1.1.7)
|
130
|
-
sqlite3-ruby (1.3.1)
|
131
|
-
stringex (1.1.0)
|
132
|
-
sys-uname (0.8.4)
|
133
|
-
term-ansicolor (1.0.5)
|
134
|
-
trollop (1.16.2)
|
135
|
-
tzinfo (0.3.22)
|
136
|
-
uuidtools (2.1.1)
|
137
|
-
will_paginate (2.3.14)
|
138
|
-
|
139
|
-
PLATFORMS
|
140
|
-
ruby
|
141
|
-
|
142
|
-
DEPENDENCIES
|
143
|
-
ZenTest
|
144
|
-
activerecord (= 2.3.8)
|
145
|
-
bundler
|
146
|
-
couch_potato (= 0.3.0)
|
147
|
-
cucumber
|
148
|
-
datamapper (= 1.0.0)
|
149
|
-
dm-migrations (= 1.0.0)
|
150
|
-
dm-sqlite-adapter (= 1.0.0)
|
151
|
-
jeweler
|
152
|
-
json_pure
|
153
|
-
mongo_mapper (= 0.8.2)
|
154
|
-
mongoid (= 1.9.1)
|
155
|
-
rake
|
156
|
-
rcov
|
157
|
-
rspactor
|
158
|
-
rspec
|
159
|
-
ruby-debug
|
160
|
-
sqlite3-ruby
|
161
|
-
tzinfo (= 0.3.22)
|
@@ -1,8 +0,0 @@
|
|
1
|
-
#This is an example of what database.yml *should* look like (when I wrote it)
|
2
|
-
#The real database.yml is generated automatically by the active record model lib (so it can be correct)
|
3
|
-
two:
|
4
|
-
adapter: sqlite3
|
5
|
-
database: /path/to/examples/features/support/../../db/activerecord_two.db
|
6
|
-
one:
|
7
|
-
adapter: sqlite3
|
8
|
-
database: /path/to/examples/features/support/../../db/activerecord_one.db
|
File without changes
|
@@ -1,11 +0,0 @@
|
|
1
|
-
Feature: example
|
2
|
-
In order to test DataBase Cleaner
|
3
|
-
Here are some scenarios that rely on the DB being clean!
|
4
|
-
|
5
|
-
Scenario: dirty the db
|
6
|
-
When I create a widget
|
7
|
-
Then I should see 1 widget
|
8
|
-
|
9
|
-
Scenario: assume a clean db
|
10
|
-
When I create a widget
|
11
|
-
Then I should see 1 widget
|
@@ -1,23 +0,0 @@
|
|
1
|
-
Feature: example
|
2
|
-
In order to test DataBase Cleaner
|
3
|
-
Here are some scenarios that rely on the DB being clean!
|
4
|
-
|
5
|
-
# Background:
|
6
|
-
# Given I have setup DatabaseCleaner to clean multiple databases
|
7
|
-
#
|
8
|
-
Scenario: dirty the db
|
9
|
-
When I create a widget in one db
|
10
|
-
And I create a widget in another db
|
11
|
-
Then I should see 1 widget in one db
|
12
|
-
And I should see 1 widget in another db
|
13
|
-
|
14
|
-
Scenario: assume a clean db
|
15
|
-
When I create a widget in one db
|
16
|
-
Then I should see 1 widget in one db
|
17
|
-
And I should see 0 widget in another db
|
18
|
-
|
19
|
-
Scenario: assume a clean db
|
20
|
-
When I create a widget in another db
|
21
|
-
Then I should see 0 widget in one db
|
22
|
-
And I should see 1 widget in another db
|
23
|
-
|
@@ -1,22 +0,0 @@
|
|
1
|
-
Feature: example
|
2
|
-
In order to test DataBase Cleaner
|
3
|
-
Here are some scenarios that rely on the DB being clean!
|
4
|
-
|
5
|
-
# Background:
|
6
|
-
# Given I have setup DatabaseCleaner to clean multiple orms
|
7
|
-
|
8
|
-
Scenario: dirty the db
|
9
|
-
When I create a widget in one orm
|
10
|
-
And I create a widget in another orm
|
11
|
-
Then I should see 1 widget in one orm
|
12
|
-
And I should see 1 widget in another orm
|
13
|
-
|
14
|
-
Scenario: assume a clean db
|
15
|
-
When I create a widget in one orm
|
16
|
-
Then I should see 1 widget in one orm
|
17
|
-
And I should see 0 widget in another orm
|
18
|
-
|
19
|
-
Scenario: assume a clean db
|
20
|
-
When I create a widget in another orm
|
21
|
-
Then I should see 0 widget in one orm
|
22
|
-
And I should see 1 widget in another orm
|
@@ -1,31 +0,0 @@
|
|
1
|
-
Given /^I have setup database cleaner to clean multiple databases using activerecord$/ do
|
2
|
-
#DatabaseCleaner
|
3
|
-
# require "#{File.dirname(__FILE__)}/../../../lib/datamapper_models"
|
4
|
-
#
|
5
|
-
# DatabaseCleaner[:datamapper, {:connection => :one} ].strategy = :truncation
|
6
|
-
# DatabaseCleaner[:datamapper, {:connection => :two} ].strategy = :truncation
|
7
|
-
end
|
8
|
-
|
9
|
-
When /^I create a widget using activerecord$/ do
|
10
|
-
ActiveRecordWidget.create!
|
11
|
-
end
|
12
|
-
|
13
|
-
Then /^I should see ([\d]+) widget using activerecord$/ do |widget_count|
|
14
|
-
ActiveRecordWidget.count.should == widget_count.to_i
|
15
|
-
end
|
16
|
-
|
17
|
-
When /^I create a widget in one db using activerecord$/ do
|
18
|
-
ActiveRecordWidgetUsingDatabaseOne.create!
|
19
|
-
end
|
20
|
-
|
21
|
-
When /^I create a widget in another db using activerecord$/ do
|
22
|
-
ActiveRecordWidgetUsingDatabaseTwo.create!
|
23
|
-
end
|
24
|
-
|
25
|
-
Then /^I should see ([\d]+) widget in one db using activerecord$/ do |widget_count|
|
26
|
-
ActiveRecordWidgetUsingDatabaseOne.count.should == widget_count.to_i
|
27
|
-
end
|
28
|
-
|
29
|
-
Then /^I should see ([\d]+) widget in another db using activerecord$/ do |widget_count|
|
30
|
-
ActiveRecordWidgetUsingDatabaseTwo.count.should == widget_count.to_i
|
31
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
Given /^I have setup database cleaner to clean multiple databases using couchpotato$/ do
|
2
|
-
#DatabaseCleaner
|
3
|
-
# require "#{File.dirname(__FILE__)}/../../../lib/couchpotato_models"
|
4
|
-
#
|
5
|
-
# DatabaseCleaner[:couchpotato, {:connection => :one} ].strategy = :truncation
|
6
|
-
# DatabaseCleaner[:couchpotato, {:connection => :two} ].strategy = :truncation
|
7
|
-
end
|
8
|
-
|
9
|
-
When /^I create a widget using couchpotato$/ do
|
10
|
-
CouchPotatoWidget.create!
|
11
|
-
end
|
12
|
-
|
13
|
-
Then /^I should see ([\d]+) widget using couchpotato$/ do |widget_count|
|
14
|
-
CouchPotatoWidget.count.should == widget_count.to_i
|
15
|
-
end
|
16
|
-
|
17
|
-
When /^I create a widget in one db using couchpotato$/ do
|
18
|
-
CouchPotatoWidgetUsingDatabaseOne.create!
|
19
|
-
end
|
20
|
-
|
21
|
-
When /^I create a widget in another db using couchpotato$/ do
|
22
|
-
CouchPotatoWidgetUsingDatabaseTwo.create!
|
23
|
-
end
|
24
|
-
|
25
|
-
Then /^I should see ([\d]+) widget in one db using couchpotato$/ do |widget_count|
|
26
|
-
CouchPotatoWidgetUsingDatabaseOne.count.should == widget_count.to_i
|
27
|
-
end
|
28
|
-
|
29
|
-
Then /^I should see ([\d]+) widget in another db using couchpotato$/ do |widget_count|
|
30
|
-
CouchPotatoWidgetUsingDatabaseTwo.count.should == widget_count.to_i
|
31
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
Given /^I have setup database cleaner to clean multiple databases using datamapper$/ do
|
2
|
-
#DatabaseCleaner
|
3
|
-
# require "#{File.dirname(__FILE__)}/../../../lib/datamapper_models"
|
4
|
-
#
|
5
|
-
# DatabaseCleaner[:datamapper, {:connection => :one} ].strategy = :truncation
|
6
|
-
# DatabaseCleaner[:datamapper, {:connection => :two} ].strategy = :truncation
|
7
|
-
end
|
8
|
-
|
9
|
-
When /^I create a widget using datamapper$/ do
|
10
|
-
DataMapperWidget.create!
|
11
|
-
end
|
12
|
-
|
13
|
-
Then /^I should see ([\d]+) widget using datamapper$/ do |widget_count|
|
14
|
-
DataMapperWidget.count.should == widget_count.to_i
|
15
|
-
end
|
16
|
-
|
17
|
-
When /^I create a widget in one db using datamapper$/ do
|
18
|
-
begin
|
19
|
-
DataMapperWidgetUsingDatabaseOne.create!
|
20
|
-
rescue StandardError => e
|
21
|
-
BREAK = e.backtrace
|
22
|
-
debugger
|
23
|
-
DataMapperWidgetUsingDatabaseOne.create!
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
When /^I create a widget in another db using datamapper$/ do
|
28
|
-
DataMapperWidgetUsingDatabaseTwo.create!
|
29
|
-
end
|
30
|
-
|
31
|
-
Then /^I should see ([\d]+) widget in one db using datamapper$/ do |widget_count|
|
32
|
-
DataMapperWidgetUsingDatabaseOne.count.should == widget_count.to_i
|
33
|
-
end
|
34
|
-
|
35
|
-
Then /^I should see ([\d]+) widget in another db using datamapper$/ do |widget_count|
|
36
|
-
DataMapperWidgetUsingDatabaseTwo.count.should == widget_count.to_i
|
37
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
When /^I create a widget using mongoid$/ do
|
2
|
-
MongoidWidget.create!( :id => rand(1000)+1000)
|
3
|
-
end
|
4
|
-
|
5
|
-
Then /^I should see ([\d]+) widget using mongoid$/ do |widget_count|
|
6
|
-
MongoidWidget.count.should == widget_count.to_i
|
7
|
-
end
|
8
|
-
|
9
|
-
When /^I create a widget in one db using mongoid$/ do
|
10
|
-
MongoidWidgetUsingDatabaseOne.create!
|
11
|
-
end
|
12
|
-
|
13
|
-
When /^I create a widget in another db using mongoid$/ do
|
14
|
-
MongoidWidgetUsingDatabaseTwo.create!
|
15
|
-
end
|
16
|
-
|
17
|
-
Then /^I should see ([\d]+) widget in one db using mongoid$/ do |widget_count|
|
18
|
-
MongoidWidgetUsingDatabaseOne.count.should == widget_count.to_i
|
19
|
-
end
|
20
|
-
|
21
|
-
Then /^I should see ([\d]+) widget in another db using mongoid$/ do |widget_count|
|
22
|
-
MongoidWidgetUsingDatabaseTwo.count.should == widget_count.to_i
|
23
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
Given /^I have setup database cleaner to clean multiple databases using mongomapper$/ do
|
2
|
-
#DatabaseCleaner
|
3
|
-
# require "#{File.dirname(__FILE__)}/../../../lib/datamapper_models"
|
4
|
-
#
|
5
|
-
# DatabaseCleaner[:datamapper, {:connection => :one} ].strategy = :truncation
|
6
|
-
# DatabaseCleaner[:datamapper, {:connection => :two} ].strategy = :truncation
|
7
|
-
end
|
8
|
-
|
9
|
-
When /^I create a widget using mongomapper$/ do
|
10
|
-
MongoMapperWidget.create!
|
11
|
-
end
|
12
|
-
|
13
|
-
Then /^I should see ([\d]+) widget using mongomapper$/ do |widget_count|
|
14
|
-
MongoMapperWidget.count.should == widget_count.to_i
|
15
|
-
end
|
16
|
-
|
17
|
-
When /^I create a widget in one db using mongomapper$/ do
|
18
|
-
MongoMapperWidgetUsingDatabaseOne.create!
|
19
|
-
end
|
20
|
-
|
21
|
-
When /^I create a widget in another db using mongomapper$/ do
|
22
|
-
MongoMapperWidgetUsingDatabaseTwo.create!
|
23
|
-
end
|
24
|
-
|
25
|
-
Then /^I should see ([\d]+) widget in one db using mongomapper$/ do |widget_count|
|
26
|
-
MongoMapperWidgetUsingDatabaseOne.count.should == widget_count.to_i
|
27
|
-
end
|
28
|
-
|
29
|
-
Then /^I should see ([\d]+) widget in another db using mongomapper$/ do |widget_count|
|
30
|
-
MongoMapperWidgetUsingDatabaseTwo.count.should == widget_count.to_i
|
31
|
-
end
|