I am new to BDD, so am not quite sure how I am supposed to write a
test like this… I get:
“ActiveRecord::RecordInvalid in ‘User should fail when passwords do
not match’
Validation failed: Password doesn’t match confirmation”
If anyone can guide me in the right direction, I’d appreciate it…
-patrick
require ‘spec_helper’
describe User do
before(:each) do
@valid_attributes = {
:login => ‘test_name’,
:password => ‘password’,
:password_confirmation => ‘password’
}
@invalid_attributes = @valid_attributes.merge(:password =>
‘not_the_same_password’)
end
it “should create a valid user” do
User.create!(@valid_attributes).should be_true
end
it “should fail when passwords do not match” do
User.create!(@invalid_attributes).should be_false
end
end