[rspec-users] before_save model callback rspec testing

Csongor Bartus lists at ruby-forum.com
Fri Jun 20 11:23:16 EDT 2008


It might be ....

I've done this :

it "should encrypt password before save" do
      user = mock("User")
      user.should_receive(:encrypt_password).with("password")
      user.save
end

but I've got :

Spec::Mocks::MockExpectationError in 'User ActiveRecord Callbacks before 
save encrypt password'
Mock 'User' received unexpected message :save with (no args)
./spec/models/user_spec.rb:84:
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list