Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save yujinakayama/6063761 to your computer and use it in GitHub Desktop.
Save yujinakayama/6063761 to your computer and use it in GitHub Desktop.
describe 'the issue with `expect(subject).to receive(:some_method).with do ... end`' do
subject { double('subject') }
context 'with #should_receive' do
it 'receives #some_method with 1' do
subject.should_receive(:some_method).with do |arg|
arg == 1
end
subject.some_method(1)
end
end
context 'with #expect' do
it 'receives #some_method with 1' do
expect(subject).to receive(:some_method).with do |arg|
arg == 1
end
subject.some_method(1)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment