Skip to content

Instantly share code, notes, and snippets.

@mrkn
Forked from sorah/foo_spec.rb
Created February 22, 2012 14:18
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 mrkn/1885314 to your computer and use it in GitHub Desktop.
Save mrkn/1885314 to your computer and use it in GitHub Desktop.
class Foo
def hi; end
def bar
hi if @flag
@flag = true
end
end
describe 'some' do
subject { Foo.new }
context 'bar has not yet been received' do
it 'does not receive hi' do
subject.should_not_receive(:hi)
subject.bar
end
end
context 'bar has already been received once' do
before do
subject.bar
end
it 'receives hi' do
subject.should_receive(:hi)
subject.bar
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment