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

patrick99e99 patrick99e99 at gmail.com
Tue Feb 16 18:42:56 EST 2010

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..


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 =>

  it "should create a valid user" do
    User.create!(@valid_attributes).should be_true

  it "should fail when passwords do not match" do
    User.create!(@invalid_attributes).should be_false


More information about the rspec-users mailing list