Skip to content

Instantly share code, notes, and snippets.

@okitan
Created February 4, 2010 06:45
Show Gist options
  • Save okitan/294405 to your computer and use it in GitHub Desktop.
Save okitan/294405 to your computer and use it in GitHub Desktop.
module RR
module DoubleDefinitions
class DoubleDefinition
def stub_chain(*args, &block)
eval(
args.flatten.inject('self') do |obj, name|
"#{obj}.stub!.#{name}"
end + ( block_given? ? ' { block.call }' : '' )
)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment