[rspec-users] Trying to write a failing test-- but am failing!

patrick99e99 patrick99e99 at gmail.com
Tue Feb 16 21:27:13 EST 2010

Hi again,

> user = User.create(@invalid_attributes)
> user.should_not be_valid

This gives me:

NoMethodError in 'User should fail when passwords do not match'
undefined method `handling_predicate!' for #<Spec::Matchers::Be:
0x104d8a518 @args=[:be_valid]>

> Try raise_error instead of raise_exception. If that works, you're
> using an older version of rspec. If not, I'm not sure what's going on.

Yeah, I wasn't carefully reading that error-- it was:
ActiveRecord::RecordInvalid in 'User should create a valid user'

I accidentally had @invalid = @valid.merge!(..new password..), and
that was breaking the should be valid test, the invalid one works with
the expect block.  So that way works...  Thank you.


More information about the rspec-users mailing list