Created
April 29, 2011 16:36
-
-
Save erubboli/948593 to your computer and use it in GitHub Desktop.
failing_spec.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe 'rspec' do | |
it { true.should be_true } | |
it "mock methods" do | |
my_obj = double('obj', {:my_method => 2}) | |
my_obj.send('my_method').should == 2 | |
end | |
it "mock hyphen methods" do | |
my_obj = double('obj', {:'method-with-hyphen'=>2}) | |
my_obj.send('method-with-hyphen').should == 2 | |
end | |
end |
fixed stubbing 'method_missing'
my_obj = double('obj', {"method_missing"=>2})
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Failure/Error: my_obj = double('obj', {:'method-with-hyphen'=>2})
/Users/erubboli/.rvm/gems/ruby-1.9.2-p180@upage/gems/rspec-mocks-2.6.0.rc2/lib/rspec/mocks/method_double.rb:78: syntax error, unexpected '-', expecting ';' or '\n'
def method-with-hyphen(*args, &block)
^
/Users/erubboli/.rvm/gems/ruby-1.9.2-p180@upage/gems/rspec-mocks-2.6.0.rc2/lib/rspec/mocks/method_double.rb:80: syntax error, unexpected keyword_end, expecting $end
./spec/lib/t.rb:11:in `block (2 levels) in <top (required)>'