mirror of
https://github.com/DatabaseCleaner/database_cleaner
synced 2023-03-27 23:22:03 -04:00
finish merge, all specs, all features pass
This commit is contained in:
parent
6250a1e7a7
commit
8dcbb697b1
15 changed files with 175 additions and 79 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,5 +4,6 @@ coverage
|
||||||
pkg
|
pkg
|
||||||
.bundle
|
.bundle
|
||||||
bundled_gems/
|
bundled_gems/
|
||||||
|
vendor/
|
||||||
examples/db/*.db
|
examples/db/*.db
|
||||||
examples/config/database.yml
|
examples/config/database.yml
|
||||||
|
|
14
Gemfile
Normal file → Executable file
14
Gemfile
Normal file → Executable file
|
@ -1,20 +1,20 @@
|
||||||
source "http://rubygems.org"
|
source "http://rubygems.org"
|
||||||
group :development do
|
group :development do
|
||||||
gem "mysql"
|
gem "mysql"
|
||||||
gem "json_pure", "1.2.0"
|
gem "json_pure", "1.4.3"
|
||||||
gem "rspec", "1.3.0"
|
gem "rspec", "1.3.0"
|
||||||
gem "cucumber"
|
gem "cucumber", "0.8.1"
|
||||||
|
|
||||||
gem "activerecord"
|
gem "activerecord"
|
||||||
|
|
||||||
gem "datamapper", "0.10.2"
|
gem "datamapper", "1.0.0"
|
||||||
gem "data_objects"
|
gem "dm-migrations", "1.0.0"
|
||||||
gem "do_sqlite3"
|
gem "dm-sqlite-adapter", "1.0.0"
|
||||||
|
|
||||||
# mongo requirements
|
# mongo requirements
|
||||||
gem "mongo", "1.0.2"
|
gem "mongo", "1.0.1"
|
||||||
gem "mongo_ext", "0.19.3"
|
gem "mongo_ext", "0.19.3"
|
||||||
gem "bson", "1.0.2"
|
gem "bson_ext", "1.0.1"
|
||||||
|
|
||||||
gem "mongoid", "1.9.0"
|
gem "mongoid", "1.9.0"
|
||||||
#mongoid requires active support <= 2.3.5
|
#mongoid requires active support <= 2.3.5
|
||||||
|
|
82
Gemfile.lock
82
Gemfile.lock
|
@ -11,11 +11,15 @@ dependencies:
|
||||||
datamapper:
|
datamapper:
|
||||||
group:
|
group:
|
||||||
- :development
|
- :development
|
||||||
version: = 0.10.2
|
version: = 1.0.0
|
||||||
mongo:
|
mongo:
|
||||||
group:
|
group:
|
||||||
- :development
|
- :development
|
||||||
version: = 1.0.2
|
version: = 1.0.1
|
||||||
|
bson_ext:
|
||||||
|
group:
|
||||||
|
- :development
|
||||||
|
version: = 1.0.1
|
||||||
ZenTest:
|
ZenTest:
|
||||||
group:
|
group:
|
||||||
- :development
|
- :development
|
||||||
|
@ -36,10 +40,6 @@ dependencies:
|
||||||
group:
|
group:
|
||||||
- :development
|
- :development
|
||||||
version: ">= 0"
|
version: ">= 0"
|
||||||
data_objects:
|
|
||||||
group:
|
|
||||||
- :development
|
|
||||||
version: ">= 0"
|
|
||||||
rake:
|
rake:
|
||||||
group:
|
group:
|
||||||
- :development
|
- :development
|
||||||
|
@ -56,14 +56,14 @@ dependencies:
|
||||||
group:
|
group:
|
||||||
- :development
|
- :development
|
||||||
version: = 1.3.0
|
version: = 1.3.0
|
||||||
bson:
|
|
||||||
group:
|
|
||||||
- :development
|
|
||||||
version: = 1.0.2
|
|
||||||
jeweler:
|
jeweler:
|
||||||
group:
|
group:
|
||||||
- :development
|
- :development
|
||||||
version: ">= 0"
|
version: ">= 0"
|
||||||
|
dm-sqlite-adapter:
|
||||||
|
group:
|
||||||
|
- :development
|
||||||
|
version: = 1.0.0
|
||||||
bundler:
|
bundler:
|
||||||
group:
|
group:
|
||||||
- :development
|
- :development
|
||||||
|
@ -75,19 +75,19 @@ dependencies:
|
||||||
cucumber:
|
cucumber:
|
||||||
group:
|
group:
|
||||||
- :development
|
- :development
|
||||||
version: ">= 0"
|
version: = 0.8.1
|
||||||
json_pure:
|
json_pure:
|
||||||
group:
|
group:
|
||||||
- :development
|
- :development
|
||||||
version: = 1.2.0
|
version: = 1.4.3
|
||||||
|
dm-migrations:
|
||||||
|
group:
|
||||||
|
- :development
|
||||||
|
version: = 1.0.0
|
||||||
activesupport:
|
activesupport:
|
||||||
group:
|
group:
|
||||||
- :development
|
- :development
|
||||||
version: <= 2.3.5
|
version: <= 2.3.5
|
||||||
do_sqlite3:
|
|
||||||
group:
|
|
||||||
- :development
|
|
||||||
version: ">= 0"
|
|
||||||
specs:
|
specs:
|
||||||
- rake:
|
- rake:
|
||||||
version: 0.8.7
|
version: 0.8.7
|
||||||
|
@ -99,10 +99,10 @@ specs:
|
||||||
version: 2.3.5
|
version: 2.3.5
|
||||||
- addressable:
|
- addressable:
|
||||||
version: 2.1.2
|
version: 2.1.2
|
||||||
- bcrypt-ruby:
|
|
||||||
version: 2.1.2
|
|
||||||
- bson:
|
- bson:
|
||||||
version: 1.0.2
|
version: 1.0.1
|
||||||
|
- bson_ext:
|
||||||
|
version: 1.0.1
|
||||||
- builder:
|
- builder:
|
||||||
version: 2.1.2
|
version: 2.1.2
|
||||||
- bundler:
|
- bundler:
|
||||||
|
@ -121,46 +121,52 @@ specs:
|
||||||
version: 0.2.31
|
version: 0.2.31
|
||||||
- diff-lcs:
|
- diff-lcs:
|
||||||
version: 1.1.2
|
version: 1.1.2
|
||||||
|
- trollop:
|
||||||
|
version: 1.16.2
|
||||||
|
- gherkin:
|
||||||
|
version: 2.0.1
|
||||||
- json_pure:
|
- json_pure:
|
||||||
version: 1.2.0
|
version: 1.4.3
|
||||||
- polyglot:
|
|
||||||
version: 0.3.1
|
|
||||||
- term-ansicolor:
|
- term-ansicolor:
|
||||||
version: 1.0.5
|
version: 1.0.5
|
||||||
- treetop:
|
|
||||||
version: 1.4.8
|
|
||||||
- cucumber:
|
- cucumber:
|
||||||
version: 0.6.4
|
version: 0.8.1
|
||||||
- data_objects:
|
- data_objects:
|
||||||
version: 0.10.2
|
version: 0.10.2
|
||||||
- extlib:
|
- extlib:
|
||||||
version: 0.9.15
|
version: 0.9.15
|
||||||
- dm-core:
|
- dm-core:
|
||||||
version: 0.10.2
|
version: 1.0.0
|
||||||
- dm-aggregates:
|
- dm-aggregates:
|
||||||
version: 0.10.2
|
version: 1.0.0
|
||||||
- dm-constraints:
|
|
||||||
version: 0.10.2
|
|
||||||
- dm-migrations:
|
- dm-migrations:
|
||||||
version: 0.10.2
|
version: 1.0.0
|
||||||
|
- dm-constraints:
|
||||||
|
version: 1.0.0
|
||||||
- fastercsv:
|
- fastercsv:
|
||||||
version: 1.5.3
|
version: 1.5.3
|
||||||
- dm-serializer:
|
- dm-serializer:
|
||||||
version: 0.10.2
|
version: 1.0.0
|
||||||
- dm-timestamps:
|
- dm-timestamps:
|
||||||
version: 0.10.2
|
version: 1.0.0
|
||||||
|
- dm-transactions:
|
||||||
|
version: 1.0.0
|
||||||
- stringex:
|
- stringex:
|
||||||
version: 1.1.0
|
version: 1.1.0
|
||||||
- uuidtools:
|
- uuidtools:
|
||||||
version: 2.1.1
|
version: 2.1.1
|
||||||
- dm-types:
|
- dm-types:
|
||||||
version: 0.10.2
|
version: 1.0.0
|
||||||
- dm-validations:
|
- dm-validations:
|
||||||
version: 0.10.2
|
version: 1.0.0
|
||||||
- datamapper:
|
- datamapper:
|
||||||
version: 0.10.2
|
version: 1.0.0
|
||||||
|
- dm-do-adapter:
|
||||||
|
version: 1.0.0
|
||||||
- do_sqlite3:
|
- do_sqlite3:
|
||||||
version: 0.10.2
|
version: 0.10.2
|
||||||
|
- dm-sqlite-adapter:
|
||||||
|
version: 1.0.0
|
||||||
- durran-validatable:
|
- durran-validatable:
|
||||||
version: 2.0.1
|
version: 2.0.1
|
||||||
- gemcutter:
|
- gemcutter:
|
||||||
|
@ -176,7 +182,7 @@ specs:
|
||||||
- linecache:
|
- linecache:
|
||||||
version: "0.43"
|
version: "0.43"
|
||||||
- mongo:
|
- mongo:
|
||||||
version: 1.0.2
|
version: 1.0.1
|
||||||
- mongo_ext:
|
- mongo_ext:
|
||||||
version: 0.19.3
|
version: 0.19.3
|
||||||
- plucky:
|
- plucky:
|
||||||
|
@ -200,11 +206,11 @@ specs:
|
||||||
version: 1.3.0
|
version: 1.3.0
|
||||||
- tzinfo:
|
- tzinfo:
|
||||||
version: 0.3.22
|
version: 0.3.22
|
||||||
hash: 8e87490eff1e76efe5e75a0c7380657e6d50ed93
|
hash: dabca3250327bd882a442aa36e3708f62eed0a76
|
||||||
sources:
|
sources:
|
||||||
- Git:
|
- Git:
|
||||||
uri: git://github.com/JonRowe/mongomapper.git
|
uri: git://github.com/JonRowe/mongomapper.git
|
||||||
git: git://github.com/JonRowe/mongomapper.git
|
git: git://github.com/JonRowe/mongomapper.git
|
||||||
ref: c93703c266085ad021a0d9987f7efa0ebd82b5ea
|
ref: 1bae62df3aea1870a948972c95d7198ddd8f39aa
|
||||||
- Rubygems:
|
- Rubygems:
|
||||||
uri: http://rubygems.org
|
uri: http://rubygems.org
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
Feature: example
|
|
||||||
In order to test DataBase Cleaner
|
|
||||||
Here are some scenarios that rely on the DB being clean!
|
|
||||||
|
|
||||||
Background:
|
|
||||||
Given I have setup database cleaner to clean multiple databases using datamapper
|
|
||||||
|
|
||||||
Scenario: dirty the db
|
|
||||||
When I create a widget in one db using datamapper
|
|
||||||
And I create a widget in another db using datamapper
|
|
||||||
Then I should see 1 widget in one db using datamapper
|
|
||||||
And I should see 1 widget in another db using datamapper
|
|
||||||
|
|
||||||
Scenario: assume a clean db
|
|
||||||
When I create a widget in one db using datamapper
|
|
||||||
Then I should see 1 widget in one db using datamapper
|
|
||||||
And I should see 0 widget in another db using datamapper
|
|
||||||
|
|
||||||
Scenario: assume a clean db
|
|
||||||
When I create a widget in another db using datamapper
|
|
||||||
Then I should see 0 widget in one db using datamapper
|
|
||||||
And I should see 1 widget in another db using datamapper
|
|
||||||
|
|
23
examples/features/step_definitions/mongoid_steps.rb
Normal file
23
examples/features/step_definitions/mongoid_steps.rb
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
When /^I create a widget using mongoid$/ do
|
||||||
|
MongoidWidget.create!( :id => rand(1000)+1000)
|
||||||
|
end
|
||||||
|
|
||||||
|
Then /^I should see ([\d]+) widget using mongoid$/ do |widget_count|
|
||||||
|
MongoidWidget.count.should == widget_count.to_i
|
||||||
|
end
|
||||||
|
|
||||||
|
When /^I create a widget in one db using mongoid$/ do
|
||||||
|
MongoidWidgetUsingDatabaseOne.create!
|
||||||
|
end
|
||||||
|
|
||||||
|
When /^I create a widget in another db using mongoid$/ do
|
||||||
|
MongoidWidgetUsingDatabaseTwo.create!
|
||||||
|
end
|
||||||
|
|
||||||
|
Then /^I should see ([\d]+) widget in one db using mongoid$/ do |widget_count|
|
||||||
|
MongoidWidgetUsingDatabaseOne.count.should == widget_count.to_i
|
||||||
|
end
|
||||||
|
|
||||||
|
Then /^I should see ([\d]+) widget in another db using mongoid$/ do |widget_count|
|
||||||
|
MongoidWidgetUsingDatabaseTwo.count.should == widget_count.to_i
|
||||||
|
end
|
|
@ -1,5 +1,9 @@
|
||||||
|
#Hilarious as it seems, this is necessary so bundle exec cucumber works for mongoid cukeage (I'm assuming mongomapper is automatically present because its a git repo)
|
||||||
|
Object.send(:remove_const, 'MongoMapper') if defined?(::MongoMapper)
|
||||||
|
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
require 'bundler'
|
require 'bundler'
|
||||||
|
|
||||||
Bundler.setup
|
Bundler.setup
|
||||||
require 'spec/expectations'
|
require 'spec/expectations'
|
||||||
require 'ruby-debug'
|
require 'ruby-debug'
|
||||||
|
@ -34,10 +38,7 @@ if orm && strategy
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if multiple_db && another_orm
|
if multiple_db
|
||||||
DatabaseCleaner[ orm.gsub(/(.)([A-Z]+)/,'\1_\2').downcase.to_sym, {:connection => :one} ].strategy = strategy.to_sym
|
|
||||||
DatabaseCleaner[ another_orm.gsub(/(.)([A-Z]+)/,'\1_\2').downcase.to_sym, {:connection => :two} ].strategy = strategy.to_sym
|
|
||||||
elsif multiple_db
|
|
||||||
DatabaseCleaner.app_root = "#{File.dirname(__FILE__)}/../.."
|
DatabaseCleaner.app_root = "#{File.dirname(__FILE__)}/../.."
|
||||||
orm_sym = orm.gsub(/(.)([A-Z]+)/,'\1_\2').downcase.to_sym
|
orm_sym = orm.gsub(/(.)([A-Z]+)/,'\1_\2').downcase.to_sym
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require 'couch_potato'
|
require 'couch_potato'
|
||||||
require 'json/pure'
|
require 'json/pure' unless defined? ::JSON
|
||||||
::CouchPotato::Config.database_name = 'couch_potato_test'
|
::CouchPotato::Config.database_name = 'couch_potato_test'
|
||||||
|
|
||||||
class CouchPotatoWidget
|
class CouchPotatoWidget
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
require "dm-core"
|
require "dm-core"
|
||||||
|
require "dm-transactions"
|
||||||
|
|
||||||
|
#Datamapper 1.0 requires you to require dm-migrations to automigrate
|
||||||
|
require "dm-migrations"
|
||||||
|
|
||||||
# only to please activerecord API used in database_cleaner/examples/features/step_definitions
|
# only to please activerecord API used in database_cleaner/examples/features/step_definitions
|
||||||
# yes, i know that's lazy ...
|
# yes, i know that's lazy ...
|
||||||
|
|
||||||
require "dm-validations"
|
require "dm-validations"
|
||||||
require "dm-aggregates"
|
require "dm-aggregates"
|
||||||
|
|
||||||
|
|
|
@ -9,15 +9,41 @@ end
|
||||||
#::MongoMapper.connection = Mongo::Connection.new('127.0.0.1')
|
#::MongoMapper.connection = Mongo::Connection.new('127.0.0.1')
|
||||||
#::MongoMapper.database = 'database_cleaner_test'
|
#::MongoMapper.database = 'database_cleaner_test'
|
||||||
|
|
||||||
class Widget
|
class MongoidWidget
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
field :id, :type => Integer
|
field :id, :type => Integer
|
||||||
field :name
|
field :name
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
#mongomapper doesn't seem to provide this...
|
#mongoid doesn't seem to provide this...
|
||||||
def create!(*args)
|
def create!(*args)
|
||||||
new(*args).save!
|
new(*args).save!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class MongoidWidgetUsingDatabaseOne
|
||||||
|
include Mongoid::Document
|
||||||
|
field :id, :type => Integer
|
||||||
|
field :name
|
||||||
|
|
||||||
|
class << self
|
||||||
|
#mongoid doesn't seem to provide this...
|
||||||
|
def create!(*args)
|
||||||
|
new(*args).save!
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class MongoidWidgetUsingDatabaseTwo
|
||||||
|
include Mongoid::Document
|
||||||
|
field :id, :type => Integer
|
||||||
|
field :name
|
||||||
|
|
||||||
|
class << self
|
||||||
|
#mongoid doesn't seem to provide this...
|
||||||
|
def create!(*args)
|
||||||
|
new(*args).save!
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -13,7 +13,17 @@ Feature: database cleaning using multiple ORMs
|
||||||
| ORM1 | ORM2 |
|
| ORM1 | ORM2 |
|
||||||
| ActiveRecord | DataMapper |
|
| ActiveRecord | DataMapper |
|
||||||
| ActiveRecord | MongoMapper |
|
| ActiveRecord | MongoMapper |
|
||||||
|
| ActiveRecord | Mongoid |
|
||||||
|
| ActiveRecord | CouchPotato |
|
||||||
|
| DataMapper | ActiveRecord |
|
||||||
| DataMapper | MongoMapper |
|
| DataMapper | MongoMapper |
|
||||||
|
| DataMapper | Mongoid |
|
||||||
| DataMapper | CouchPotato |
|
| DataMapper | CouchPotato |
|
||||||
|
| MongoMapper | ActiveRecord |
|
||||||
|
| MongoMapper | DataMapper |
|
||||||
|
| MongoMapper | Mongoid |
|
||||||
| MongoMapper | CouchPotato |
|
| MongoMapper | CouchPotato |
|
||||||
| CouchPotato | ActiveRecord |
|
| CouchPotato | ActiveRecord |
|
||||||
|
| CouchPotato | DataMapper |
|
||||||
|
| CouchPotato | MongoMapper |
|
||||||
|
| CouchPotato | Mongoid |
|
||||||
|
|
|
@ -4,7 +4,7 @@ Given /^I am using (ActiveRecord|DataMapper|MongoMapper|Mongoid|CouchPotato)$/ d
|
||||||
@feature_runner.orm = orm
|
@feature_runner.orm = orm
|
||||||
end
|
end
|
||||||
|
|
||||||
Given /^I am using (ActiveRecord|DataMapper|MongoMapper|CouchPotato) and (ActiveRecord|DataMapper|MongoMapper|CouchPotato)$/ do |orm1,orm2|
|
Given /^I am using (ActiveRecord|DataMapper|MongoMapper|CouchPotato|Mongoid) and (ActiveRecord|DataMapper|MongoMapper|CouchPotato|Mongoid)$/ do |orm1,orm2|
|
||||||
@feature_runner = FeatureRunner.new
|
@feature_runner = FeatureRunner.new
|
||||||
@feature_runner.orm = orm1
|
@feature_runner.orm = orm1
|
||||||
@feature_runner.another_orm = orm2
|
@feature_runner.another_orm = orm2
|
||||||
|
|
|
@ -13,11 +13,22 @@ class FeatureRunner
|
||||||
def go(feature)
|
def go(feature)
|
||||||
full_dir ||= File.expand_path(File.dirname(__FILE__) + "/../../examples/")
|
full_dir ||= File.expand_path(File.dirname(__FILE__) + "/../../examples/")
|
||||||
Dir.chdir(full_dir) do
|
Dir.chdir(full_dir) do
|
||||||
|
|
||||||
|
|
||||||
ENV['ORM'] = orm
|
ENV['ORM'] = orm
|
||||||
ENV['ANOTHER_ORM'] = another_orm if another_orm
|
|
||||||
ENV['MULTIPLE_DBS'] = "true" if multiple_databases
|
|
||||||
ENV['STRATEGY'] = strategy
|
ENV['STRATEGY'] = strategy
|
||||||
|
|
||||||
|
if another_orm
|
||||||
|
ENV['ANOTHER_ORM'] = another_orm
|
||||||
|
else
|
||||||
|
ENV['ANOTHER_ORM'] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if multiple_databases
|
||||||
|
ENV['MULTIPLE_DBS'] = "true"
|
||||||
|
else
|
||||||
|
ENV['MULTIPLE_DBS'] = nil
|
||||||
|
end
|
||||||
|
|
||||||
self.output = `#{"jruby -S " if defined?(JRUBY_VERSION)}cucumber features/#{feature}.feature`
|
self.output = `#{"jruby -S " if defined?(JRUBY_VERSION)}cucumber features/#{feature}.feature`
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ module DataMapper
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
class Sqlite3Adapter < DataObjectsAdapter
|
class Sqlite3Adapter < DataObjectsAdapter
|
||||||
|
|
||||||
# taken from http://github.com/godfat/dm-mapping/tree/master
|
# taken from http://github.com/godfat/dm-mapping/tree/master
|
||||||
|
@ -62,7 +63,32 @@ module DataMapper
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class SqliteAdapter < DataObjectsAdapter
|
||||||
|
# taken from http://github.com/godfat/dm-mapping/tree/master
|
||||||
|
def storage_names(repository = :default)
|
||||||
|
# activerecord-2.1.0/lib/active_record/connection_adapters/sqlite_adapter.rb: 177
|
||||||
|
sql = <<-SQL.compress_lines
|
||||||
|
SELECT name
|
||||||
|
FROM sqlite_master
|
||||||
|
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
||||||
|
SQL
|
||||||
|
# activerecord-2.1.0/lib/active_record/connection_adapters/sqlite_adapter.rb: 181
|
||||||
|
select(sql)
|
||||||
|
end
|
||||||
|
|
||||||
|
def truncate_table(table_name)
|
||||||
|
execute("DELETE FROM #{quote_name(table_name)};")
|
||||||
|
end
|
||||||
|
|
||||||
|
# this is a no-op copied from activerecord
|
||||||
|
# i didn't find out if/how this is possible
|
||||||
|
# activerecord also doesn't do more here
|
||||||
|
def disable_referential_integrity
|
||||||
|
yield
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
# FIXME
|
# FIXME
|
||||||
# i don't know if this works
|
# i don't know if this works
|
||||||
|
|
|
@ -58,6 +58,7 @@ module DatabaseCleaner
|
||||||
Object.const_set('ActiveRecord','Actively mocking records.')
|
Object.const_set('ActiveRecord','Actively mocking records.')
|
||||||
Object.const_set('DataMapper', 'Mapping data mocks')
|
Object.const_set('DataMapper', 'Mapping data mocks')
|
||||||
Object.const_set('MongoMapper', 'Mapping mock mongos')
|
Object.const_set('MongoMapper', 'Mapping mock mongos')
|
||||||
|
Object.const_set('Mongoid', 'Mongoid mock')
|
||||||
Object.const_set('CouchPotato', 'Couching mock potatos')
|
Object.const_set('CouchPotato', 'Couching mock potatos')
|
||||||
|
|
||||||
cleaner.orm.should == :active_record
|
cleaner.orm.should == :active_record
|
||||||
|
@ -66,6 +67,7 @@ module DatabaseCleaner
|
||||||
it "should detect DataMapper second" do
|
it "should detect DataMapper second" do
|
||||||
Object.const_set('DataMapper', 'Mapping data mocks')
|
Object.const_set('DataMapper', 'Mapping data mocks')
|
||||||
Object.const_set('MongoMapper', 'Mapping mock mongos')
|
Object.const_set('MongoMapper', 'Mapping mock mongos')
|
||||||
|
Object.const_set('Mongoid', 'Mongoid mock')
|
||||||
Object.const_set('CouchPotato', 'Couching mock potatos')
|
Object.const_set('CouchPotato', 'Couching mock potatos')
|
||||||
|
|
||||||
cleaner.orm.should == :data_mapper
|
cleaner.orm.should == :data_mapper
|
||||||
|
@ -73,11 +75,19 @@ module DatabaseCleaner
|
||||||
|
|
||||||
it "should detect MongoMapper third" do
|
it "should detect MongoMapper third" do
|
||||||
Object.const_set('MongoMapper', 'Mapping mock mongos')
|
Object.const_set('MongoMapper', 'Mapping mock mongos')
|
||||||
|
Object.const_set('Mongoid', 'Mongoid mock')
|
||||||
Object.const_set('CouchPotato', 'Couching mock potatos')
|
Object.const_set('CouchPotato', 'Couching mock potatos')
|
||||||
|
|
||||||
cleaner.orm.should == :mongo_mapper
|
cleaner.orm.should == :mongo_mapper
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should detect Mongoid fourth" do
|
||||||
|
Object.const_set('Mongoid', 'Mongoid mock')
|
||||||
|
Object.const_set('CouchPotato', 'Couching mock potatos')
|
||||||
|
|
||||||
|
cleaner.orm.should == :mongoid
|
||||||
|
end
|
||||||
|
|
||||||
it "should detect CouchPotato last" do
|
it "should detect CouchPotato last" do
|
||||||
Object.const_set('CouchPotato', 'Couching mock potatos')
|
Object.const_set('CouchPotato', 'Couching mock potatos')
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue