From 29d70b79ebe58066c5b55c3510b5d6ac4a41d4e0 Mon Sep 17 00:00:00 2001 From: Corin Langosch Date: Wed, 30 Mar 2011 10:27:03 +0200 Subject: [PATCH] added basic specs --- Gemfile | 1 + Gemfile.lock | 2 ++ spec/database_cleaner/sequel/base_spec.rb | 31 +++++++++++++++++++ .../sequel/transaction_spec.rb | 21 +++++++++++++ .../sequel/truncation_spec.rb | 13 ++++++++ 5 files changed, 68 insertions(+) create mode 100644 spec/database_cleaner/sequel/base_spec.rb create mode 100644 spec/database_cleaner/sequel/transaction_spec.rb create mode 100644 spec/database_cleaner/sequel/truncation_spec.rb diff --git a/Gemfile b/Gemfile index 04fe03e..67a1c77 100755 --- a/Gemfile +++ b/Gemfile @@ -32,6 +32,7 @@ group :development do gem "tzinfo", "0.3.22" gem "mongo_mapper", "0.8.2" gem "couch_potato", "0.3.0" + gem "sequel", "~>3.21.0" #gem "ibm_db" # I don't want to add this dependency, even as a dev one since it requires DB2 to be installed end diff --git a/Gemfile.lock b/Gemfile.lock index e3b42ba..050ada7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -127,6 +127,7 @@ GEM linecache (>= 0.3) rubyforge (2.0.4) json_pure (>= 1.1.7) + sequel (3.21.0) sqlite3-ruby (1.3.1) stringex (1.1.0) sys-uname (0.8.4) @@ -157,5 +158,6 @@ DEPENDENCIES rspactor rspec ruby-debug + sequel (~> 3.21.0) sqlite3-ruby tzinfo (= 0.3.22) diff --git a/spec/database_cleaner/sequel/base_spec.rb b/spec/database_cleaner/sequel/base_spec.rb new file mode 100644 index 0000000..7f3b582 --- /dev/null +++ b/spec/database_cleaner/sequel/base_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' +require 'database_cleaner/sequel/base' +require 'database_cleaner/shared_strategy_spec' +require 'sequel' + +module DatabaseCleaner + describe Sequel do + it { should respond_to(:available_strategies) } + end + + module Sequel + class ExampleStrategy + include ::DatabaseCleaner::Sequel::Base + end + + describe ExampleStrategy do + it_should_behave_like "a generic strategy" + it { should respond_to(:db) } + it { should respond_to(:db=) } + + it "should store my desired db" do + subject.db = :my_db + subject.db.should == :my_db + end + + it "should default to :default" do + subject.db.should == :default + end + end + end +end diff --git a/spec/database_cleaner/sequel/transaction_spec.rb b/spec/database_cleaner/sequel/transaction_spec.rb new file mode 100644 index 0000000..1e3c360 --- /dev/null +++ b/spec/database_cleaner/sequel/transaction_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper' +require 'database_cleaner/sequel/transaction' +require 'database_cleaner/shared_strategy_spec' +require 'sequel' + +module DatabaseCleaner + module Sequel + describe Transaction do + it_should_behave_like "a generic strategy" + it_should_behave_like "a generic transaction strategy" + + describe "start" do + it "should start a transaction" + end + + describe "clean" do + it "should finish a transaction" + end + end + end +end diff --git a/spec/database_cleaner/sequel/truncation_spec.rb b/spec/database_cleaner/sequel/truncation_spec.rb new file mode 100644 index 0000000..0bbc660 --- /dev/null +++ b/spec/database_cleaner/sequel/truncation_spec.rb @@ -0,0 +1,13 @@ +require 'spec_helper' +require 'database_cleaner/sequel/truncation' +require 'database_cleaner/shared_strategy_spec' +require 'sequel' + +module DatabaseCleaner + module Sequel + describe Truncation do + it_should_behave_like "a generic strategy" + it_should_behave_like "a generic truncation strategy" + end + end +end