Skip to content

Commit

Permalink
Ignoring raise double() specs for ruby 1.9.2
Browse files Browse the repository at this point in the history
This ignores specs that check for the removal of
`to_str` from Ruby 1.9.2 as they won't work there
due to the Ruby runtime calling `to_str` on a double
without checking if the double implements `to_str`.
  • Loading branch information
mauricio committed Feb 17, 2014
1 parent 80c740e commit 6c21ac6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions lib/rspec/mocks/test_double.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ def to_s
inspect.gsub('<','[').gsub('>',']')
end

#alias_method :to_str, :to_s

# @private
def respond_to?(message, incl_private=false)
__mock_proxy.null_object? ? true : super
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/mocks/double_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ def add_call
end
end

describe "#to_str" do
describe "#to_str", :unless => RUBY_VERSION == '1.9.2' do
it "should not respond to #to_str to avoid being coerced to strings by the runtime" do
double = double("Foo")
expect { double.to_str }.to raise_error(
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/mocks/verifying_double_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ module Mocks
}.to raise_error(/Module or String expected/)
end

it "trying to raise a class_double raises a TypeError" do
it "trying to raise a class_double raises a TypeError", :unless => RUBY_VERSION == '1.9.2' do
subject = Object.new
class_double("StubbedError").as_stubbed_const
allow(subject).to receive(:some_method).and_raise(StubbedError)
Expand Down

0 comments on commit 6c21ac6

Please sign in to comment.