Skip to content

Instantly share code, notes, and snippets.

@alloy
Created November 2, 2010 12:05
Show Gist options
  • Save alloy/659540 to your computer and use it in GitHub Desktop.
Save alloy/659540 to your computer and use it in GitHub Desktop.
$ cat t.rb
require 'rubygems'
gem 'mocha-macruby', '0.9.8.20100129120100'
#gem 'mocha-macruby', '0.9.9.20101102121900'
require 'mocha'
require 'bacon'
require 'mocha-on-bacon'
Bacon.summary_on_exit
describe "Mocha on MacRuby" do
it "overrides native objc methods" do
m = mock('foo')
m.expects(:init).returns(m)
m.init
end
end
$ macruby t.rb
Mocha on MacRuby
- overrides native objc methods [ERROR: RuntimeError]
RuntimeError: cannot undefine method `init' because it is a native method
/Library/Frameworks/MacRuby.framework/Versions/0.8/usr/lib/ruby/Gems/1.9.2/gems/mocha-on-bacon-0.1.1/lib/mocha-on-bacon.rb:17:in `it:': Mocha on MacRuby - overrides native objc methods
/Users/eloy/code/MacRuby/mocha/t.rb:13:in `block'
/Users/eloy/code/MacRuby/mocha/t.rb:12:in `<main>'
1 specifications (0 requirements), 0 failures, 1 errors
$ cat t.rb
require 'rubygems'
#gem 'mocha-macruby', '0.9.8.20100129120100'
gem 'mocha-macruby', '0.9.9.20101102121900'
require 'mocha'
require 'bacon'
require 'mocha-on-bacon'
Bacon.summary_on_exit
describe "Mocha on MacRuby" do
it "overrides native objc methods" do
m = mock('foo')
m.expects(:init).returns(m)
m.init
end
end
$ macruby t.rb
Mocha on MacRuby
- overrides native objc methods
1 specifications (1 requirements), 0 failures, 0 errors
@floehopper
Copy link

Sorry I haven't had a chance to this about this much more. I've just added it as a Lighthouse ticket with some initial thoughts. Cheers, James.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment