我尝试在Rspec中定义自己的'context'方法。 有下一个:
module MiscSpecHelper
def its_ok
context "if everything is OK" do
yield
end
end
end
在spec文件中:
describe "GET index" do
its_ok do
it "has a 200 status code" do
get :index
expect(response.status).to eq(200)
end
end
end
我得到了:
GET index
has a 200 status code
我期待:
GET index
if everything is OK
has a 200 status code
为什么忽略我的'上下文'描述?
答案 0 :(得分:0)
module MiscSpecHelper
def its_ok(&block)
context "if everything is OK", &block
end
end