無論何時我在測試中使用root_url
,我都會收到http://www.example.com
。Rails 3.1在測試環境中設置主機
它工作正常發展,在那裏我的config /環境/ development.rb有這樣的:
Rails.application.routes.default_url_options[:host]= 'localhost:3000'
增加,這並不在配置/環境/ test.rb工作,雖然。我應該添加什麼來使用localhost:3000
作爲測試環境中的主機?
這是一個常見問題,請參閱此主題:http://rubyforge.org/pipermail/rspec-users/2012-January/021016.html –