Skip to content

Instantly share code, notes, and snippets.

@dpick
Created April 17, 2012 03:06
Show Gist options
  • Save dpick/2403108 to your computer and use it in GitHub Desktop.
Save dpick/2403108 to your computer and use it in GitHub Desktop.
require 'rspec'
class Foo
def initialize(list); @list = list; end
def method_missing(*args)
@list << args.first
end
end
describe Foo do
before :all do
$methods = []
end
before :each do
@subject = Foo.new($methods)
end
it 'adds to the method listt' do
@subject.bar
end
it 'adds to the method list again' do
@subject.hi
end
it 'has 2 methods in the list' do
$methods.should == [:bar, :hi]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment