Skip to content

Instantly share code, notes, and snippets.

@harlow
Created April 6, 2013 16:53
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 harlow/5326780 to your computer and use it in GitHub Desktop.
Save harlow/5326780 to your computer and use it in GitHub Desktop.
using spies with rspec-mocks
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