1

Railsを3.2.6から3.2.7に更新すると、プロジェクトhttps://github.com/phoet/on_rubyのRSpecテストスイートが失敗します。

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)>'

この問題は、RSpecを直接実行している場合は発生しません。また、travisでは発生しません:http ://travis-ci.org/#!/ phoet / on_ruby / builds / 1989858

トランザクションが適切にロールバックされていないように見えます。誰かが同様の行動を経験しましたか?

何か案は?

4

1 に答える 1

2

私も同じです。私の知る限り、Rails は ENV['RAILS_ENV']=development に設定されているため、テストは開発データベースに対して実行されます。試すrake spec RAILS_ENV=test

この問題のようです: https://github.com/rails/rails/issues/7175

于 2012-07-30T22:05:25.767 に答える