Skip to content

Instantly share code, notes, and snippets.

@myronmarston
Created July 28, 2010 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myronmarston/495138 to your computer and use it in GitHub Desktop.
Save myronmarston/495138 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'rspec'
class Base
def static1; :static1; end
def static2; :static2; end
define_method :dynamic1 do :dynamic1; end
define_method :dynamic2 do :dynamic2; end
end
class Sub < Base
def static1; super; end
define_method :static2 do super; end
def dynamic1; super; end
define_method :dynamic2 do super; end
end
describe Sub do
its(:static1) { should == :static1 }
its(:static2) { should == :static2 }
its(:dynamic1) { should == :dynamic1 }
its(:dynamic2) { should == :dynamic2 }
end
ruby-1.9.2-rc2 ➜ ruby implicit_super.rb
.F.F
Finished in 0.006 seconds
4 examples, 2 failures
1) Sub static2
Failure/Error: Unable to find matching line from backtrace
implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly.
# rspec_example.rb:14:in `block in <class:Sub>'
# rspec_example.rb:21:in `block (2 levels) in <main>'
2) Sub dynamic2
Failure/Error: Unable to find matching line from backtrace
implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly.
# rspec_example.rb:16:in `block in <class:Sub>'
# rspec_example.rb:23:in `block (2 levels) in <main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment