rails/rails — Issue #3276: validates_uniqueness_of is not working for mysql apps
Author: bridgeutopia
Created: 2011-10-10 09:31:18+00:00
State: open

I have 3 rails 3.1.1 apps using Postgresql and all tests pass.

I have 2 Rails 3.1.1 apps running mysql.
For mysql apps, all tests pass except for validates_uniqueness of

1) User validate presence of fields for new user
Failure/Error: it { should validate_uniqueness_of(:username) }
Expected errors to include "has already been taken" when username is set to "person5", got errors: ["email can't be blank (\"\")", "password can't be blank (nil)"]
# ./spec/models/user_spec.rb:17:in `block (3 levels) in '

2) User validate presence of fields for new user
Failure/Error: it { should validate_uniqueness_of(:email) }
Expected errors to include "has already been taken" when email is set to "vicenta.ledner@quigleycollier.info", got errors: ["password can't be blank (nil)"]
# ./spec/models/user_spec.rb:19:in `block (3 levels) in '

I'm pretty sure it's not a shoulda/rspec issue. All tests pass for PostgreSQL apps running same version (3.1.1) of Rails.