Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow specs to run on ruby 1.8.6.

  • Loading branch information...
commit 1f3e0f7900f22b77f227014b8c9718ce54eb59a8 1 parent b8135d5
@myronmarston myronmarston authored dchelimsky committed
Showing with 15 additions and 2 deletions.
  1. +4 −2 spec/rspec/mocks/mock_spec.rb
  2. +11 −0 spec/spec_helper.rb
View
6 spec/rspec/mocks/mock_spec.rb
@@ -151,9 +151,11 @@ module Mocks
}.to raise_error(RSpec::Mocks::MockExpectationError, /Double \"test double\" received :something but passed block failed with: expected false to be true/)
end
- it "passes block to expectation block" do
+ it "passes block to expectation block", :ruby => '> 1.8.6' do
a = nil
- @mock.should_receive(:something) { |&block| a = block }
+ # We eval this because Ruby 1.8.6's syntax parser barfs on { |&block| ... }
+ # and prevents the entire spec suite from running.
+ eval("@mock.should_receive(:something) { |&block| a = block }")
b = lambda { }
@mock.something(&b)
a.should == b
View
11 spec/spec_helper.rb
@@ -38,4 +38,15 @@ def treats_method_missing_as_private(options = {:noop => true, :subject => nil})
config.color_enabled = true
config.extend(Macros)
config.include(RSpec::Mocks::Methods)
+
+ config.filter_run_excluding :ruby => lambda {|version|
+ case version.to_s
+ when "!jruby"
+ RUBY_ENGINE != "jruby"
+ when /^> (.*)/
+ !(RUBY_VERSION.to_s > $1)
+ else
+ !(RUBY_VERSION.to_s =~ /^#{version.to_s}/)
+ end
+ }
end
Please sign in to comment.
Something went wrong with that request. Please try again.