rspec_rails_4 icon indicating copy to clipboard operation
rspec_rails_4 copied to clipboard

Ch.5, p.62 - Clarification needed

Open olerass opened this issue 12 years ago • 0 comments
trafficstars

On page 62 the to_csv method takes an argument:

format.csv do
  send_data Contact.to_csv(@contacts),
  type: 'text/csv; charset=iso-8859-1; header=present',  
  disposition: 'attachment; filename=contacts.csv'
end

but on page 63 it doesn't:

expect(Contact.to_csv).to match /Aaron Sumner,[email protected]/

How does the method know which contact to convert to csv here? If it just converts ALL contacts without arguments, then why is an argument given on page 62? Maybe add a note about how this works to clarify.

Book version: 2013-10-29 (PDF)

olerass avatar Nov 02 '13 13:11 olerass