Permalink
Browse files

Allow specs to run on ruby 1.8.6.

  • Loading branch information...
1 parent b8135d5 commit 1f3e0f7900f22b77f227014b8c9718ce54eb59a8 @myronmarston myronmarston committed with dchelimsky Oct 9, 2010
Showing with 15 additions and 2 deletions.
  1. +4 −2 spec/rspec/mocks/mock_spec.rb
  2. +11 −0 spec/spec_helper.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
@@ -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

0 comments on commit 1f3e0f7

Please sign in to comment.