Permalink
Browse files

Upgrade to RSpec 2.3

  • Loading branch information...
1 parent bf68644 commit ce4c1af26b2af5fe64287dd32215f84784f00b29 @jferris jferris committed Jan 31, 2011
View
@@ -0,0 +1,2 @@
+--color
+--format documentation
View
@@ -2,7 +2,7 @@ source "http://rubygems.org"
gem "rails", "~> 3.0.3"
gem "sqlite3-ruby", :require => false
-gem "rspec", "~> 1.3"
+gem "rspec", "~> 2.3"
gem "bourne"
gem "webmock"
gem "rake"
View
@@ -86,7 +86,14 @@ GEM
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.8.7)
- rspec (1.3.1)
+ rspec (2.3.0)
+ rspec-core (~> 2.3.0)
+ rspec-expectations (~> 2.3.0)
+ rspec-mocks (~> 2.3.0)
+ rspec-core (2.3.1)
+ rspec-expectations (2.3.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.3.0)
ruby-debug (0.10.4)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.4.0)
@@ -125,7 +132,7 @@ DEPENDENCIES
json
rails (~> 3.0.3)
rake
- rspec (~> 1.3)
+ rspec (~> 2.3)
ruby-debug
sham_rack
sinatra
View
@@ -6,7 +6,7 @@ require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/gempackagetask'
require 'cucumber/rake/task'
-require 'spec/rake/spectask'
+require 'rspec/core/rake_task'
require 'yard'
desc 'Default: run the specs and features.'
@@ -15,9 +15,9 @@ task :default => :spec do
end
desc 'Test the copycopter_client plugin.'
-Spec::Rake::SpecTask.new do |t|
- t.spec_opts = ['--options', "spec/spec.opts"]
- t.spec_files = FileList['spec/copycopter_client/**/*_spec.rb']
+RSpec::Core::RakeTask.new do |t|
+ t.rspec_opts = ['--color', "--format progress"]
+ t.pattern = 'spec/copycopter_client/**/*_spec.rb'
end
desc "Run cucumber features"
@@ -7,7 +7,7 @@ gem "sqlite3-ruby", {:require=>false}
gem "rake"
gem "bourne"
gem "sham_rack"
-gem "rspec", "~> 1.3"
+gem "rspec", "~> 2.3"
gem "yard", {:require=>false}
gem "aruba"
gem "thin"
@@ -50,7 +50,14 @@ GEM
activesupport (= 2.3.9)
rake (>= 0.8.3)
rake (0.8.7)
- rspec (1.3.0)
+ rspec (2.3.0)
+ rspec-core (~> 2.3.0)
+ rspec-expectations (~> 2.3.0)
+ rspec-mocks (~> 2.3.0)
+ rspec-core (2.3.1)
+ rspec-expectations (2.3.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.3.0)
ruby-debug (0.10.3)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.3.0)
@@ -84,7 +91,7 @@ DEPENDENCIES
json
rails (~> 2.3)
rake
- rspec (~> 1.3)
+ rspec (~> 2.3)
ruby-debug
sham_rack
sinatra
@@ -7,7 +7,7 @@ gem "sqlite3-ruby", {:require=>false}
gem "rake"
gem "bourne"
gem "sham_rack"
-gem "rspec", "~> 1.3"
+gem "rspec", "~> 2.3"
gem "yard", {:require=>false}
gem "aruba"
gem "thin"
@@ -87,7 +87,14 @@ GEM
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.8.7)
- rspec (1.3.0)
+ rspec (2.3.0)
+ rspec-core (~> 2.3.0)
+ rspec-expectations (~> 2.3.0)
+ rspec-mocks (~> 2.3.0)
+ rspec-core (2.3.1)
+ rspec-expectations (2.3.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.3.0)
ruby-debug (0.10.3)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.3.0)
@@ -125,7 +132,7 @@ DEPENDENCIES
json
rails (~> 3.0.3)
rake
- rspec (~> 1.3)
+ rspec (~> 2.3)
ruby-debug
sham_rack
sinatra
@@ -1,7 +1,7 @@
require 'spec_helper'
describe CopycopterClient::Configuration do
- Spec::Matchers.define :have_config_option do |option|
+ RSpec::Matchers.define :have_config_option do |option|
match do |config|
config.should respond_to(option)
@@ -204,6 +204,7 @@
CopycopterClient::Client.stubs(:new => client)
CopycopterClient::Sync.stubs(:new => sync)
subject.logger = logger
+ apply
end
it { should be_applied }
@@ -233,51 +234,51 @@
end
describe CopycopterClient::Configuration, "applied when testing" do
- it_should_behave_like "applied configuration"
+ it_should_behave_like "applied configuration" do
+ it "doesn't start sync" do
+ sync.should have_received(:start).never
+ end
+ end
- before do
+ def apply
subject.environment_name = 'test'
subject.apply
end
-
- it "doesn't start sync" do
- sync.should have_received(:start).never
- end
end
describe CopycopterClient::Configuration, "applied when not testing" do
- it_should_behave_like "applied configuration"
+ it_should_behave_like "applied configuration" do
+ it "starts sync" do
+ sync.should have_received(:start)
+ end
+ end
- before do
+ def apply
subject.environment_name = 'development'
subject.apply
end
-
- it "starts sync" do
- sync.should have_received(:start)
- end
end
describe CopycopterClient::Configuration, "applied when developing with middleware" do
- it_should_behave_like "applied configuration"
+ it_should_behave_like "applied configuration" do
+ it "adds the sync middleware" do
+ middleware.should include(CopycopterClient::RequestSync)
+ end
+ end
let(:middleware) { MiddlewareStack.new }
- before do
+ def apply
subject.middleware = middleware
subject.environment_name = 'development'
subject.apply
end
-
- it "adds the sync middleware" do
- middleware.should include(CopycopterClient::RequestSync)
- end
end
describe CopycopterClient::Configuration, "applied when developing without middleware" do
it_should_behave_like "applied configuration"
- before do
+ def apply
subject.middleware = nil
subject.environment_name = 'development'
subject.apply
@@ -289,7 +290,7 @@
let(:middleware) { MiddlewareStack.new }
- before do
+ def apply
subject.middleware = middleware
subject.environment_name = 'test'
subject.apply
@@ -12,7 +12,7 @@ def warn(*args); end # these are annoying in test output
I18n.stubs(:translate)
end
- Spec::Matchers.define :have_translated do |key, default|
+ RSpec::Matchers.define :have_translated do |key, default|
match do |ignored_subject|
extend Mocha::API
I18n.should have_received(:translate).with(key, :default => default)
@@ -343,7 +343,7 @@ def build_sync(config = {})
end
describe "given locked mutex" do
- Spec::Matchers.define :finish_after_unlocking do |mutex|
+ RSpec::Matchers.define :finish_after_unlocking do |mutex|
match do |thread|
sleep(0.1)
View
@@ -1,2 +0,0 @@
---format progress
---color
View
@@ -1,6 +1,5 @@
require 'rubygems'
-require 'spec'
-require 'spec/autorun'
+require 'rspec'
require 'bourne'
require 'sham_rack'
require 'webmock/rspec'
@@ -18,7 +17,7 @@
WebMock.disable_net_connect!
ShamRack.mount(FakeCopycopterApp.new, "copycopter.com", 443)
-Spec::Runner.configure do |config|
+RSpec.configure do |config|
config.include ClientSpecHelpers
config.include WebMock::API
config.mock_with :mocha
@@ -41,7 +41,7 @@ def has_entry?(level, expected_entry)
attr_reader :entries
end
-Spec::Matchers.define :have_entry do |severity, entry|
+RSpec::Matchers.define :have_entry do |severity, entry|
match do |logger|
@logger = logger
logger.has_entry?(severity, entry)

0 comments on commit ce4c1af

Please sign in to comment.