I am new to devise and rails and I just integrated devise with my sample app. What I noticed is after creating a user model, all my unit tests were failing. I went to try to narrow this and found that even the generated assert 'the truth' one for user_test.rb
also fails:
ActiveRecord::RecordNotUnique: SQLite3::ConstraintException: \ column email is not unique: INSERT INTO "users" (...
Once I commented out the add_index
...
# add_index :users, :email, :unique => true
... and re-ran rake db:test:load
and re-run tests with ruby -I test test/unit/user_test.rb
it passes.
Has anyone else experience this?
Failing tests are indicated with FAIL in the output. So all you have to do is filter the output for that word. Note that this is purely text processing, it doesn't know anything about go tests and their results. This means you might get "false positives" if a test outputs the word FAIL even if it succeeds.
If you just generated the devise model, a fixture was also generated with more or less this content:
one: {} # column: value # two: {} # column: value
This fixture tries to create two users, with the same (inexistant) email. Replace it by:
one: email: [email protected] two: email: [email protected]
It will fix this error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With