On Nov 20, 8:43 pm, "Doug E." <d...@emeryit.com> wrote: > 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 => 'f...@b...@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 => '....@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...@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 > _______________________________________________ > rspec-users mailing list > rspec-us...@rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
I'll add that this behavior only occurs with the model User. I set up some similar tests for other classes (named Sample and SampleClassification). These do not have the same problem. Their validation tests pass during batch and single test runs. I created a new User model from scratch with a single validates_presence_of call, and got the same unexpected behavior: in single spec runs they pass, and in batch runs they fail. Doug _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users