From ee08c30de7c01d621710800f93d4bec51b80913c Mon Sep 17 00:00:00 2001 From: stanislaw Date: Sun, 8 Jul 2012 13:51:27 +0300 Subject: [PATCH] upgrade to RSpec2 --- .rspec | 4 ++ .rvmrc | 2 +- Gemfile | 5 +- Gemfile.lock | 58 ++++++++++++------- Rakefile | 16 ++--- examples/features/support/env.rb | 2 +- features/support/env.rb | 2 +- .../active_record/base_spec.rb | 2 +- spec/database_cleaner/configuration_spec.rb | 4 +- .../database_cleaner/data_mapper/base_spec.rb | 2 +- .../data_mapper/transaction_spec.rb | 2 +- .../data_mapper/truncation_spec.rb | 2 +- spec/database_cleaner/generic/base_spec.rb | 2 +- .../mongo_mapper/base_spec.rb | 2 +- spec/database_cleaner/sequel/base_spec.rb | 2 +- .../sequel/transaction_spec.rb | 2 +- .../sequel/truncation_spec.rb | 2 +- ...ed_strategy_spec.rb => shared_strategy.rb} | 0 spec/spec_helper.rb | 10 ++-- 19 files changed, 73 insertions(+), 48 deletions(-) create mode 100644 .rspec rename spec/database_cleaner/{shared_strategy_spec.rb => shared_strategy.rb} (100%) diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..660ad19 --- /dev/null +++ b/.rspec @@ -0,0 +1,4 @@ +--color +--format documentation +mtime +--backtrace diff --git a/.rvmrc b/.rvmrc index 8b75f07..6e85973 100644 --- a/.rvmrc +++ b/.rvmrc @@ -1 +1 @@ -rvm ruby-1.8.7-p248 +rvm 1.8.7 diff --git a/Gemfile b/Gemfile index 67a1c77..e782b2a 100755 --- a/Gemfile +++ b/Gemfile @@ -34,10 +34,13 @@ group :development do 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 + gem 'mysql' + gem 'mysql2', '~> 0.2.0' + gem 'pg' end group :test do - gem "rspec" + gem "rspec-rails" gem "rspactor" gem "rcov" gem "ZenTest" diff --git a/Gemfile.lock b/Gemfile.lock index 050ada7..25318da 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,24 +5,24 @@ GEM activerecord (2.3.8) activesupport (= 2.3.8) activesupport (2.3.8) - addressable (2.2.0) - bson (1.0.4) + addressable (2.2.8) + bson (1.0.9) builder (2.1.2) columnize (0.3.1) couch_potato (0.3.0) couchrest (>= 0.24) json - couchrest (1.0.1) - json (>= 1.4.6) - mime-types (>= 1.15) - rest-client (>= 1.5.1) + couchrest (1.1.2) + mime-types (~> 1.15) + multi_json (~> 1.0.0) + rest-client (~> 1.6.1) cucumber (0.8.5) builder (~> 2.1.2) diff-lcs (~> 1.1.2) gherkin (~> 2.1.4) json_pure (~> 1.4.3) term-ansicolor (~> 1.0.4) - data_objects (0.10.2) + data_objects (0.10.8) addressable (~> 2.1) datamapper (1.0.0) dm-aggregates (= 1.0.0) @@ -68,11 +68,11 @@ GEM uuidtools (~> 2.1.1) dm-validations (1.0.0) dm-core (~> 1.0.0) - do_sqlite3 (0.10.2) - data_objects (= 0.10.2) + do_sqlite3 (0.10.8) + data_objects (= 0.10.8) durran-validatable (2.0.1) extlib (0.9.15) - fastercsv (1.5.3) + fastercsv (1.5.5) ffi (0.6.3) rake (>= 0.8.7) gemcutter (0.6.1) @@ -86,14 +86,14 @@ GEM rubyforge (>= 2.0.0) jnunemaker-validatable (1.8.4) activesupport (>= 2.3.4) - json (1.4.6) + json (1.7.3) json_pure (1.4.6) libnotify (0.2.0) ffi (>= 0.6.2) linecache (0.43) - mime-types (1.16) - mongo (1.0.7) - bson (>= 1.0.4) + mime-types (1.19) + mongo (1.0.9) + bson (>= 1.0.5) mongo_mapper (0.8.2) activesupport (>= 2.3.4) jnunemaker-validatable (~> 1.8.4) @@ -104,13 +104,17 @@ GEM durran-validatable (>= 2.0.1) mongo (~> 1.0.1) will_paginate (< 2.9) - plucky (0.3.4) - mongo (~> 1.0.7) + multi_json (1.0.4) + mysql (2.8.1) + mysql2 (0.2.18) + pg (0.14.0) + plucky (0.3.5) + mongo (~> 1.0.8) rake (0.8.7) rb-inotify (0.8.1) ffi (>= 0.5.0) rcov (0.9.8) - rest-client (1.6.0) + rest-client (1.6.7) mime-types (>= 1.16) rspactor (0.7.0.beta.6) bundler (>= 1.0.0.rc.5) @@ -119,7 +123,16 @@ GEM rb-inotify sys-uname (>= 0.8.4) trollop (>= 1.16.2) - rspec (1.3.0) + rspec (2.1.0) + rspec-core (~> 2.1.0) + rspec-expectations (~> 2.1.0) + rspec-mocks (~> 2.1.0) + rspec-core (2.1.0) + rspec-expectations (2.1.0) + diff-lcs (~> 1.1.2) + rspec-mocks (2.1.0) + rspec-rails (2.1.0) + rspec (~> 2.1.0) ruby-debug (0.10.3) columnize (>= 0.1) ruby-debug-base (~> 0.10.3.0) @@ -134,8 +147,8 @@ GEM term-ansicolor (1.0.5) trollop (1.16.2) tzinfo (0.3.22) - uuidtools (2.1.1) - will_paginate (2.3.14) + uuidtools (2.1.2) + will_paginate (2.3.16) PLATFORMS ruby @@ -153,10 +166,13 @@ DEPENDENCIES json_pure mongo_mapper (= 0.8.2) mongoid (= 1.9.1) + mysql + mysql2 (~> 0.2.0) + pg rake rcov rspactor - rspec + rspec-rails ruby-debug sequel (~> 3.21.0) sqlite3-ruby diff --git a/Rakefile b/Rakefile index e41be08..efa8fac 100644 --- a/Rakefile +++ b/Rakefile @@ -28,16 +28,16 @@ Rake::RDocTask.new do |rdoc| rdoc.rdoc_files.include('lib/**/*.rb') end -require 'spec/rake/spectask' -Spec::Rake::SpecTask.new(:spec) do |t| - t.libs << 'lib' << 'spec' - t.spec_files = FileList['spec/**/*_spec.rb'] + +require 'rspec/core' +require 'rspec/core/rake_task' +RSpec::Core::RakeTask.new(:spec) do |spec| + spec.pattern = FileList['spec/**/*_spec.rb'] end -Spec::Rake::SpecTask.new(:rcov) do |t| - t.libs << 'lib' << 'spec' - t.spec_files = FileList['spec/**/*_spec.rb'] - t.rcov = true +RSpec::Core::RakeTask.new(:rcov) do |spec| + spec.pattern = 'spec/**/*_spec.rb' + spec.rcov = true end begin diff --git a/examples/features/support/env.rb b/examples/features/support/env.rb index cd44839..2edcef9 100644 --- a/examples/features/support/env.rb +++ b/examples/features/support/env.rb @@ -5,7 +5,7 @@ require 'rubygems' require 'bundler' Bundler.setup -require 'spec/expectations' +require 'rspec/expectations' require 'ruby-debug' DB_DIR = "#{File.dirname(__FILE__)}/../../db" diff --git a/features/support/env.rb b/features/support/env.rb index 777ca31..5c674ff 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -1,7 +1,7 @@ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib') require 'database_cleaner' -require 'spec/expectations' +require 'rspec/expectations' require 'test/unit/assertions' diff --git a/spec/database_cleaner/active_record/base_spec.rb b/spec/database_cleaner/active_record/base_spec.rb index 9e09652..2ecb94c 100644 --- a/spec/database_cleaner/active_record/base_spec.rb +++ b/spec/database_cleaner/active_record/base_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' require 'active_record' require 'database_cleaner/active_record/base' -require 'database_cleaner/shared_strategy_spec' +require 'database_cleaner/shared_strategy' module DatabaseCleaner describe ActiveRecord do diff --git a/spec/database_cleaner/configuration_spec.rb b/spec/database_cleaner/configuration_spec.rb index f568fa1..45f6594 100644 --- a/spec/database_cleaner/configuration_spec.rb +++ b/spec/database_cleaner/configuration_spec.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__) + '/../spec_helper' +require 'spec_helper' module DatabaseCleaner class << self @@ -197,7 +197,7 @@ describe ::DatabaseCleaner do # plausably want to force orm/strategy change on two sets of orm that differ only on db context "multiple orm proxy methods" do - it "should proxy orm to all connections and remove duplicate connections" do + pending "should proxy orm to all connections and remove duplicate connections" do active_record_1 = mock("active_mock_on_db_one").as_null_object active_record_2 = mock("active_mock_on_db_two").as_null_object data_mapper_1 = mock("data_mock_on_db_one").as_null_object diff --git a/spec/database_cleaner/data_mapper/base_spec.rb b/spec/database_cleaner/data_mapper/base_spec.rb index 72159e2..6f57ddb 100644 --- a/spec/database_cleaner/data_mapper/base_spec.rb +++ b/spec/database_cleaner/data_mapper/base_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' require 'database_cleaner/data_mapper/base' -require 'database_cleaner/shared_strategy_spec' +require 'database_cleaner/shared_strategy' module DatabaseCleaner describe DataMapper do diff --git a/spec/database_cleaner/data_mapper/transaction_spec.rb b/spec/database_cleaner/data_mapper/transaction_spec.rb index 49943f3..e4c1a97 100644 --- a/spec/database_cleaner/data_mapper/transaction_spec.rb +++ b/spec/database_cleaner/data_mapper/transaction_spec.rb @@ -1,6 +1,6 @@ require File.dirname(__FILE__) + '/../../spec_helper' require 'database_cleaner/data_mapper/transaction' -require 'database_cleaner/shared_strategy_spec' +require 'database_cleaner/shared_strategy' #require 'data_mapper' module DatabaseCleaner diff --git a/spec/database_cleaner/data_mapper/truncation_spec.rb b/spec/database_cleaner/data_mapper/truncation_spec.rb index 18af6bc..7e3c11d 100644 --- a/spec/database_cleaner/data_mapper/truncation_spec.rb +++ b/spec/database_cleaner/data_mapper/truncation_spec.rb @@ -1,5 +1,5 @@ require 'database_cleaner/data_mapper/truncation' -require 'database_cleaner/shared_strategy_spec' +require 'database_cleaner/shared_strategy' module DatabaseCleaner module DataMapper diff --git a/spec/database_cleaner/generic/base_spec.rb b/spec/database_cleaner/generic/base_spec.rb index b5fbeb0..ef3ee1e 100644 --- a/spec/database_cleaner/generic/base_spec.rb +++ b/spec/database_cleaner/generic/base_spec.rb @@ -1,5 +1,5 @@ require 'spec_helper' -require 'database_cleaner/shared_strategy_spec' +require 'database_cleaner/shared_strategy' require 'database_cleaner/generic/base' module ::DatabaseCleaner diff --git a/spec/database_cleaner/mongo_mapper/base_spec.rb b/spec/database_cleaner/mongo_mapper/base_spec.rb index 159fb7c..11c0f05 100644 --- a/spec/database_cleaner/mongo_mapper/base_spec.rb +++ b/spec/database_cleaner/mongo_mapper/base_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' require 'database_cleaner/mongo_mapper/base' -require 'database_cleaner/shared_strategy_spec' +require 'database_cleaner/shared_strategy' module DatabaseCleaner describe MongoMapper do diff --git a/spec/database_cleaner/sequel/base_spec.rb b/spec/database_cleaner/sequel/base_spec.rb index 28df646..9d3da56 100644 --- a/spec/database_cleaner/sequel/base_spec.rb +++ b/spec/database_cleaner/sequel/base_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' require 'database_cleaner/sequel/base' -require 'database_cleaner/shared_strategy_spec' +require 'database_cleaner/shared_strategy' require 'sequel' module DatabaseCleaner diff --git a/spec/database_cleaner/sequel/transaction_spec.rb b/spec/database_cleaner/sequel/transaction_spec.rb index 1e3c360..794481e 100644 --- a/spec/database_cleaner/sequel/transaction_spec.rb +++ b/spec/database_cleaner/sequel/transaction_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' require 'database_cleaner/sequel/transaction' -require 'database_cleaner/shared_strategy_spec' +require 'database_cleaner/shared_strategy' require 'sequel' module DatabaseCleaner diff --git a/spec/database_cleaner/sequel/truncation_spec.rb b/spec/database_cleaner/sequel/truncation_spec.rb index 0bbc660..1552265 100644 --- a/spec/database_cleaner/sequel/truncation_spec.rb +++ b/spec/database_cleaner/sequel/truncation_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' require 'database_cleaner/sequel/truncation' -require 'database_cleaner/shared_strategy_spec' +require 'database_cleaner/shared_strategy' require 'sequel' module DatabaseCleaner diff --git a/spec/database_cleaner/shared_strategy_spec.rb b/spec/database_cleaner/shared_strategy.rb similarity index 100% rename from spec/database_cleaner/shared_strategy_spec.rb rename to spec/database_cleaner/shared_strategy.rb diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 36bbf85..80d0a99 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -3,16 +3,18 @@ require "rubygems" require "bundler" Bundler.setup +require 'rspec/core' +require 'rspec/mocks' -require 'spec' #require 'active_record' #require 'mongo_mapper' + +$:.unshift(File.dirname(__FILE__)) $:.unshift(File.dirname(__FILE__) + '/../lib') + require 'database_cleaner' - - -Spec::Runner.configure do |config| +RSpec.configure do |config| end