Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Up to date merged Rspec2 compatibility. #80

Closed
wants to merge 4 commits into from

6 participants

@james2m

I've brought my master up to 1.04 and applied the rspec2 fixes. Any chance of bringing this into master?

@oruen

I'd love to see this in master.

@rdy

+1

@mcmire
Collaborator

Closing this one since I merged in #68.

@mcmire mcmire closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 22, 2011
  1. @james2m

    Progress.

    Brian Takita authored james2m committed
  2. @nicknovitski @james2m
  3. @nicknovitski @james2m

    define have_received for rspec2, re: issue #45

    nicknovitski authored james2m committed
  4. @james2m
This page is out of date. Refresh to see the latest.
View
4 Gemfile
@@ -1,12 +1,12 @@
source :rubygems
group :test do
- gem "rspec", "1.3.0"
+ gem "rspec", "2.0.1"
gem "session", "3.1.0"
gem "diff-lcs", "1.1.2"
if RUBY_VERSION.include?("1.9")
gem "ruby-debug19", "0.11.6"
else
gem "ruby-debug", "0.10.4"
- end
+end
end
View
6 README.rdoc
@@ -36,10 +36,8 @@ Currently RR implements mocks, stubs, proxies, and spies. Fakes usually require
end
=== rspec
- Spec::Runner.configure do |config|
- config.mock_with :rr
- # or if that doesn't work due to a version incompatibility
- # config.mock_with RR::Adapters::Rspec
+ RSpec.configure do |config|
+ config.mock_framework = :rr
end
== standalone
View
1  lib/rr.rb
@@ -83,6 +83,7 @@
require "#{dir}/rr/spy_verification"
require "#{dir}/rr/adapters/rspec"
+require "#{dir}/rr/adapters/rspec2"
require "#{dir}/rr/adapters/test_unit"
require "#{dir}/rr/adapters/minitest"
View
22 lib/rr/adapters/rspec2.rb
@@ -0,0 +1,22 @@
+module RR
+ module Adapters
+ module RSpec2
+
+ include RRMethods
+
+ def setup_mocks_for_rspec
+ RR.reset
+ end
+ def verify_mocks_for_rspec
+ RR.verify
+ end
+ def teardown_mocks_for_rspec
+ RR.reset
+ end
+
+ def have_received(method = nil)
+ RR::Adapters::Rspec::InvocationMatcher.new(method)
+ end
+ end
+ end
+end
View
3  spec/core_spec_suite.rb
@@ -1,5 +1,4 @@
-require "rubygems"
-require "spec"
+require "#{File.dirname(__FILE__)}/spec_helper"
class CoreExampleSuite
def run
View
5 spec/environment_fixture_setup.rb
@@ -1,8 +1,7 @@
require "rubygems"
-require "spec"
-require "spec/autorun"
+require "rspec"
require "bundler"
-$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
+$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib")
require "rr"
require "pp"
View
12 spec/rr/adapters/rr_methods_spec_helper.rb
@@ -1,11 +1,7 @@
# require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
-module RR
- module Adapters
- describe RRMethods, :shared => true do
- before do
- extend RR::Adapters::RRMethods
- end
- end
+shared_examples_for "RR::Adapters::RRMethods" do
+ before do
+ extend RR::Adapters::RRMethods
end
-end
+end
View
2  spec/rr/expectations/times_called_expectation/times_called_expectation_helper.rb
@@ -1,6 +1,6 @@
module RR
module Expectations
- describe TimesCalledExpectation, :shared => true do
+ shared_examples_for TimesCalledExpectation do
attr_reader :subject
it_should_behave_like "Swapped Space"
before do
View
10 spec/rr/rspec/rspec_backtrace_tweaking_spec.rb
@@ -9,16 +9,6 @@ module Adapters
end
end
- describe ".included" do
- it "does not add backtrace identifier twice" do
- length = ::Spec::Runner::QuietBacktraceTweaker::IGNORE_PATTERNS.length
- class << Object.new
- include ::RR::Adapters::Rspec
- end
- ::Spec::Runner::QuietBacktraceTweaker::IGNORE_PATTERNS.length.should == length
- end
- end
-
describe "backtrace tweaking" do
it "hides rr library from the backtrace by default" do
dir = File.dirname(__FILE__)
View
3  spec/rspec_spec_suite.rb
@@ -1,5 +1,4 @@
-require "rubygems"
-require "spec"
+require "#{File.dirname(__FILE__)}/spec_helper"
class RspecExampleSuite
def run
View
10 spec/spec.opts
@@ -1,10 +0,0 @@
---colour
---format
-progress
---loadby
-mtime
---reverse
---timeout
-20
---diff
---backtrace
View
8 spec/spec_suite.rb
@@ -16,11 +16,11 @@ def run
end
def run_core_examples
- run_suite("#{dir}/core_spec_suite.rb #{spec_opts}") || raise("Core suite Failed")
+ run_suite("#{dir}/core_spec_suite.rb") || raise("Core suite Failed")
end
def run_rspec_examples
- run_suite("#{dir}/rspec_spec_suite.rb #{spec_opts}") || raise("Rspec suite Failed")
+ run_suite("#{dir}/rspec_spec_suite.rb") || raise("Rspec suite Failed")
end
def run_test_unit_examples
@@ -40,10 +40,6 @@ def run_suite(path)
return status == 0
end
- def spec_opts
- File.read("#{dir}/spec.opts").split("\n").join(" ")
- end
-
def dir
File.dirname(__FILE__)
end
View
3  spec/test_unit_spec_suite.rb
@@ -1,5 +1,4 @@
-require "rubygems"
-require "spec"
+require "#{File.dirname(__FILE__)}/spec_helper"
class TestUnitTestSuite
def run
Something went wrong with that request. Please try again.