2012-07-30 226 views
1

我的項目https://github.com/phoet/on_ruby的RSpec測試套件在將Rails從3.2.6更新到3.2.7時失敗。RSpec測試失敗的Rails 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)>' 

不直接運行RSpec的時候才能出現在特拉維斯會出現此問題,也不:http://travis-ci.org/#!/phoet/on_ruby/builds/1989858

它看起來好像交易不正確回滾。有人遇到類似的行爲?

任何想法?

回答

2

我明白了。從我所知道的情況來看,rails現在設置了ENV ['RAILS_ENV'] =開發,所以你的測試正在針對你的開發數據庫運行。嘗試rake spec RAILS_ENV=test

看起來像是這個問題:https://github.com/rails/rails/issues/7175