我有这个config/initializer.rb,它让我加载yaml /config/application.yaml并执行类似于APP_CONFIG [“myvar”]的操作,我怎样才能为我的SPECS启用它?如何使用if语句在规范内部进行条件检查?
我的目标是做这样的事情:
require "spec_helper"
describe BetaController do
describe "routing" do
if APP_CONFIG["viral"] and APP_CONFIG["beta"]
it "routes to #index do" do
get("/").should route_to("home#index")
end
end
end
end
是这是你正在使用的宝石,还是你自己写的东西? –
@farleyknight是这样的:http://fredwu.me/post/632640092/rails-use-app-config-for-your-application-specific – Rubytastic
该博客帖子是从2010年开始的,它链接到的项目是no更长的维护。我会寻找一种方法来迁移到在github页面上链接到的新项目。 –