spec updates
This commit is contained in:
parent
6ce2df9373
commit
201343af63
|
@ -1,4 +1,5 @@
|
|||
require 'spec_helper'
|
||||
require 'active_record'
|
||||
require 'database_cleaner/active_record/base'
|
||||
require 'database_cleaner/shared_strategy_spec'
|
||||
|
||||
|
@ -13,7 +14,7 @@ module DatabaseCleaner
|
|||
end
|
||||
|
||||
describe ExampleStrategy do
|
||||
it_should_behave_like "database cleaner strategy"
|
||||
it_should_behave_like "a generic strategy"
|
||||
it { expect{ subject.connection_klass }.to_not raise_error }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,23 +1,14 @@
|
|||
require File.dirname(__FILE__) + '/../../spec_helper'
|
||||
require 'database_cleaner/couch_potato/truncation'
|
||||
require 'couch_potato'
|
||||
|
||||
module DatabaseCleaner
|
||||
module CouchPotato
|
||||
|
||||
describe Truncation do
|
||||
|
||||
#doing the require in the file root breaks autospec, doing it before(:all) just fails the specs
|
||||
before(:all) do
|
||||
#pend the specs if CouchPotato is missing
|
||||
if defined?(::CouchPotato)
|
||||
require 'couch_potato'
|
||||
end
|
||||
end
|
||||
|
||||
let (:database) { mock('database') }
|
||||
|
||||
before(:each) do
|
||||
#pend the specs if CouchPotato is missing
|
||||
pending "Please install couchdb and couch_potato before running these specs" unless defined?(::CouchPotato)
|
||||
::CouchPotato.stub!(:couchrest_database).and_return(database)
|
||||
end
|
||||
|
||||
|
|
|
@ -13,9 +13,7 @@ module ::DatabaseCleaner
|
|||
its (:available_strategies) { should be_empty }
|
||||
end
|
||||
|
||||
it { should respond_to :db }
|
||||
it { should respond_to :db= }
|
||||
it { should respond_to :connection_klass }
|
||||
it_should_behave_like "a generic strategy"
|
||||
|
||||
its (:db) { should == :default }
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
require File.dirname(__FILE__) + '/../../spec_helper'
|
||||
require 'database_cleaner/mongo_mapper/truncation'
|
||||
require 'mongo_mapper'
|
||||
require File.dirname(__FILE__) + '/mongo_examples'
|
||||
|
||||
module DatabaseCleaner
|
||||
module MongoMapper
|
||||
|
@ -8,20 +10,12 @@ module DatabaseCleaner
|
|||
|
||||
#doing this in the file root breaks autospec, doing it before(:all) just fails the specs
|
||||
before(:all) do
|
||||
#pend the specs if MongoMapper is missing
|
||||
if defined?(::MongoMapper) && defined?(::Mongo)
|
||||
require 'mongo_mapper'
|
||||
require File.dirname(__FILE__) + '/mongo_examples'
|
||||
|
||||
::MongoMapper.connection = ::Mongo::Connection.new('127.0.0.1')
|
||||
@test_db = 'database_cleaner_specs'
|
||||
::MongoMapper.database = @test_db
|
||||
end
|
||||
end
|
||||
|
||||
before(:each) do
|
||||
#make these specs pend if orm not installed
|
||||
pending "Please install MongoMapper + Mongo to run these specs" unless defined?(::MongoMapper) && defined?(::Mongo)
|
||||
::MongoMapper.connection.drop_database(@test_db)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
shared_examples_for "database cleaner strategy" do
|
||||
shared_examples_for "a generic strategy" do
|
||||
it { should respond_to :db }
|
||||
it { should respond_to :db= }
|
||||
it { should respond_to :connection_klass }
|
||||
end
|
||||
|
||||
shared_examples_for "a generic truncation strategy" do
|
||||
it { should respond_to :start }
|
||||
it { should respond_to :clean }
|
||||
end
|
||||
|
||||
shared_examples_for "a generic transaction strategy" do
|
||||
it { should respond_to :start }
|
||||
it { should respond_to :clean }
|
||||
end
|
|
@ -1,6 +1,6 @@
|
|||
require 'rubygems'
|
||||
require 'spec'
|
||||
require 'active_record'
|
||||
#require 'active_record'
|
||||
#require 'mongo_mapper'
|
||||
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
||||
require 'database_cleaner'
|
||||
|
|
Loading…
Reference in New Issue