Re: [rspec-users] Trouble testing a method with loop

2008-02-04 Thread David Currin
Great, thanks for that, d. On 04/02/2008, Pat Maddox <[EMAIL PROTECTED]> wrote: > Extract the company creation to a method, so that that method only > builds one record at a time. Test that it works properly. Then you > can keep the test that you have, verifying that it creates the right > numb

Re: [rspec-users] Trouble testing a method with loop

2008-02-04 Thread Pat Maddox
Extract the company creation to a method, so that that method only builds one record at a time. Test that it works properly. Then you can keep the test that you have, verifying that it creates the right number of records. Pat ___ rspec-users mailing li

Re: [rspec-users] Trouble testing a method with loop

2008-02-04 Thread David Currin
Thanks, Point taken about less interaction with the database. The 'companies' mock is an exact representation of the companies list returned by the basecamp api which is why there's 37 records in there. I need to learn to think more clearly about separation from the database I guess. The point is

Re: [rspec-users] Trouble testing a method with loop

2008-02-04 Thread David Chelimsky
On Feb 4, 2008 5:24 AM, David Currin <[EMAIL PROTECTED]> wrote: > I'm having trouble working out how to test a method that contains a > loop. I'm new to rspec so not sure what the best way is to tackle > this. > > class Company < ActiveRecord::Base > > def self.sync_with_basecamp > companies = ba

[rspec-users] Trouble testing a method with loop

2008-02-04 Thread David Currin
I'm having trouble working out how to test a method that contains a loop. I'm new to rspec so not sure what the best way is to tackle this. class Company < ActiveRecord::Base def self.sync_with_basecamp companies = basecamp_fetch("companies") companies.each do |c| company = self.find_or_