Skip to content

Instantly share code, notes, and snippets.

@justinko
Created November 26, 2011 22:54
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 justinko/1396448 to your computer and use it in GitHub Desktop.
Save justinko/1396448 to your computer and use it in GitHub Desktop.
class MyClass
def self.all_methods
all_singleton_methods + all_instance_methods
end
def self.all_singleton_methods
singleton_methods
end
def self.all_instance_methods
instance_methods
end
end
describe MyClass
describe '.all_methods' do
before do
MyClass.stubs(all_singleton_methods: [:a], all_instance_methods: [:b])
end
it 'returns all singleton and instance methods' do
MyClass.all_methods.should eq([:a, :b])
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment