Created
April 6, 2013 16:53
-
-
Save harlow/5326780 to your computer and use it in GitHub Desktop.
using spies with rspec-mocks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe Importer, '#import' do | |
it 'creates a record for each row' do | |
contact = double(create: true) | |
csv_parser = double(rows: [:row1, :row2]) | |
Importer.new(contact, csv_parser).import | |
expect(contact).to have_received(:create).with(:row1) | |
expect(contact).to have_received(:create).with(:row2) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment