Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.0.0alpha4 should_validate_uniqueness_of error #22

Open
danielevans opened this issue Apr 27, 2011 · 4 comments
Open

4.0.0alpha4 should_validate_uniqueness_of error #22

danielevans opened this issue Apr 27, 2011 · 4 comments

Comments

@danielevans
Copy link

With an extremely simple model and spec:
class User < ActiveRecord::Base
validates_uniqueness_of :username
end

describe User do
should_validate_uniqueness_of :username
end

The following error is produced

Failures:

  1. User
    Failure/Error: send(should_or_should_not, send(method, *args, &block))
    ScriptError:
    could not find a User record in the database

    ./spec/models/user_spec.rb:4

    ./spec/models/user_spec.rb:3

EDIT:
Using Rails 3.0.7
rspec 2.5.0
remarkable 4.0.0.alpha4

@samwgoldman
Copy link

Me too.

@danielevans
Copy link
Author

I have been writing full specs myself to route around the problem.

For intance:

Factory(:user, :username => "Bob")
Factory.build(:user, :username => "bob").should have_at_least(1).error_on(:username)

@coderberry
Copy link

@danielevans Thanks for your comment.

@santuxus
Copy link

santuxus commented Jan 4, 2012

I have the same problem... I thought it was due to :scope, but should_validate_uniqueness_of without a :spec also produces this error. I will use a workaround, but I'd like to ask if there is a new version planned in some near future?

rails (3.1.3)
remarkable (4.0.0.alpha4)
rspec (2.8.0.rc1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants