anmaxp wrote:

I'm having sort of an issue here, I'm trying to test the update of the
last_login field upon login, here is my test

  it "assigns a new last_login timestamp" do
    User.expects(:update_attribute).at_least_once.returns(true)

User.any_instance.expects(:update_attribute).with(:field, value).etc.

An instance of User will itself call the .update_attribute. The class won't 
call it.

However, I can't think of a reason not to just write the record, reload it, and check the fields. And a _functional_ test should not care how the record got written (update_attribute, save, or whatever). A unit test might care, but functional tests need a little more float...

--
  Phlip
  http://flea.sourceforge.net/resume.html

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to