Reputation: 18835
The RSpec test suite for my project https://github.com/phoet/on_ruby fails when updating Rails from 3.2.6 to 3.2.7.
rake spec
1) Authorization should create an auth and a user from an auth-hash
Failure/Error: Authorization.create_from_hash(auth)
ActiveRecord::RecordNotUnique:
SQLite3::ConstraintException: column nickname is not unique: INSERT INTO "users" ("admin", "available", "created_at", "description", "freelancer", "github", "hide_jobs", "image", "location", "name", "nickname", "slug", "updated_at", "url") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
# ./app/models/user.rb:74:in `create_from_hash!'
# ./app/models/authorization.rb:15:in `create_from_hash'
# ./spec/models/authorization_spec.rb:23:in `block (3 levels) in <top (required)>'
# ./spec/models/authorization_spec.rb:22:in `block (2 levels) in <top (required)>'
Google Geocoding API error: over query limit. | ETA: 00:00:03
2) Location finder should find users within the default scope
Failure/Error: Location.unscoped.all.size.should be(2)
expected #<Fixnum:5> => 2
got #<Fixnum:21> => 10
Compared using equal?, which compares object identity,
but expected and actual are not the same object. Use
'actual.should eq(expected)' if you don't care about
object identity in this example.
# ./spec/models/location_spec.rb:16:in `block (3 levels) in <top (required)>'
This problem does not occur when running RSpec directly, nor does it occur on travis: http://travis-ci.org/#!/phoet/on_ruby/builds/1989858
It looks as if the transactions do not rollback properly. Did someone experience a similar behavior?
Any Ideas?
Upvotes: 1
Views: 669
Reputation: 111
I'm getting the same. From what I can tell, rails is now sets ENV['RAILS_ENV']=development, so your tests are running against you development database. Try rake spec RAILS_ENV=test
It looks like it's this issue: https://github.com/rails/rails/issues/7175
Upvotes: 2