Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Rails 中,如果我使用 rspec 运行测试,rspec 会自动将环境更改为:test并开始执行测试吗?一旦完成测试,环境会变回:development吗?我可以在哪里找到有关此的更多信息的任何指针?
:test
:development
test除非您像这样更改它,否则测试将始终运行RAILS_ENV=development rspec spec/
test
RAILS_ENV=development rspec spec/
development然后是服务器和控制台。
development
是的,它在 :test 环境中运行。
它不会“改变”,您可以运行多个环境(例如,您可以让您的开发服务器同时运行和执行测试)