我有rspec测试,即描述和it
我想补充一下
before :all
和
before :each
行为
describe "test" do
before :all do
CONTINUE_SPEC= true
end
around :each do |example|
if CONTINUE_SPEC
CONTINUE_SPEC = false
example.run
CONTINUE_SPEC = true unless example.exception
else
example.skip
end
end
... actual tests...
然而,我想在几乎每一个规范中都有它,所以我想我可以使用一个
require_relative
声明,使其变得简单。但是,当我使用require\u relative将代码传输到文件时
require_relative '../../support/continue_test_if_passing'
我明白了
Failure/Error:
before :all do
CONTINUE_SPEC= true
end
NoMethodError:
undefined method `before' for main:Object