[rspec-users] What causes "undefined method `each_pair'"?

Nick nick at deadorange.com
Mon Aug 29 11:33:16 EDT 2011

Hey folks. I've been running into this problem a lot lately, and haven't 
been able to figure out what's causing it, nor how to fix it:

Failure/Error: @importer = SpreadsheetImporter.new @catalog, @excel, 
  undefined method `each_pair' for #<Catalog:0xb885f08>
# ./app/models/spreadsheet_importer.rb:15:in `initialize'
# ./spec/models/spreadsheet_importer_spec.rb:25:in `new'
# ./spec/models/spreadsheet_importer_spec.rb:25:in `block (2 levels) in <top 

Line 15 of spreadsheet_importer.rb is:
@products_importer  = SpreadsheetImporter::Products.new catalog, spreadsheet

Line 25 of spreadsheet_importer_spec.rb is:
@importer = SpreadsheetImporter.new @catalog, @excel, @photos_dir

What perplexes me is that I've stubbed out the call to 
SpreadsheetImporter::Products.new , so the class' initializer isn't being 

Here're some more complete code snippets:

Any help would be greatly appreciated. Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110829/c24bb438/attachment-0001.html>

More information about the rspec-users mailing list