[rspec-users] specs pass individually, but fail using autotest

Doug E. doug at emeryit.com
Sat Nov 20 20:43:12 EST 2010


Hi,
I'm trying to run autotest and I'm using ryanb's nifty authentication
with Rails 3 and Rpec 2. When I run autotest, the user model spec
fails all its validation tests with the "error_on" matcher.

If I run the spec by itself, it passes. If I'm running autotest and
make a trivial change to the spec and save it, so that autotest  runs
just the user spec by itself, it passes. All the other tests in the
spec pass. If I hit Ctrl-C to rerun the tests, these tests will fail
again.

Only the ones of the form "new_user(:password => 'bad').should
have(1).error_on(:password)" fail.

Below is the output from autotest, including the initial run, and
second run after I make a trivial change to the spec.

Thanks.
Doug

>>>>>>>>>>

Failures:
  1) User should require username
     Failure/Error: new_user(:username => '').should
have(1).error_on(:username)
     expected 1 error on :username, got 0
     # ./spec/models/user_spec.rb:21:in `block (2 levels) in <top
(required)>'

  2) User should require password
     Failure/Error: new_user(:password => '').should
have(1).error_on(:password)
     expected 1 error on :password, got 0
     # ./spec/models/user_spec.rb:25:in `block (2 levels) in <top
(required)>'

  3) User should require well formed email
     Failure/Error: new_user(:email => 'foo at bar@example.com').should
have(1).error_on(:email)
     expected 1 error on :email, got 0
     # ./spec/models/user_spec.rb:29:in `block (2 levels) in <top
(required)>'

  4) User should validate uniqueness of email
     Failure/Error: new_user(:email => 'bar at example.com').should
have(1).error_on(:email)
     expected 1 error on :email, got 0
     # ./spec/models/user_spec.rb:34:in `block (2 levels) in <top
(required)>'

  5) User should validate uniqueness of username
     Failure/Error: new_user(:username => 'uniquename').should
have(1).error_on(:username)
     expected 1 error on :username, got 0
     # ./spec/models/user_spec.rb:39:in `block (2 levels) in <top
(required)>'

  6) User should not allow odd characters in username
     Failure/Error: new_user(:username => 'odd ^&(@)').should
have(1).error_on(:username)
     expected 1 error on :username, got 0
     # ./spec/models/user_spec.rb:43:in `block (2 levels) in <top
(required)>'

  7) User should validate password is longer than 3 characters
     Failure/Error: new_user(:password => 'bad').should
have(1).error_on(:password)
     expected 1 error on :password, got 0
     # ./spec/models/user_spec.rb:47:in `block (2 levels) in <top
(required)>'

  8) User should require matching password confirmation
     Failure/Error: new_user(:password_confirmation =>
'nonmatching').should have(1).error_on(:password)
     expected 1 error on :password, got 0
     # ./spec/models/user_spec.rb:51:in `block (2 levels) in <top
(required)>'

Finished in 3.46 seconds
111 examples, 8 failures, 4 pending
bundle exec /Users/doug/.rvm/rubies/ruby-1.9.2-p0/bin/ruby -S /Users/
doug/.rvm/gems/ruby-1.9.2-p0 at class-proto/gems/rspec-core-2.0.1/bin/
rspec --autotest '/Users/doug/dev/hg/class-proto/spec/models/
user_spec.rb'
...Trivial change
...........

Finished in 1.17 seconds
14 examples, 0 failures


More information about the rspec-users mailing list