gpt4 book ai didi

ruby-on-rails - RSpec - WrongScopeError : expect is not available on an example group

转载 作者:行者123 更新时间:2023-12-04 23:45:16 24 4
gpt4 key购买 nike

我收到此错误:

method_missing': expect is not available on an example group (e.g. a describe or context block). It is only available from within individual examples (e.g. it blocks) or from constructs that run in the scope of an example (e.g. before, let, etc). (RSpec::Core::ExampleGroup::WrongScopeError)



对于此规范:
describe 'canary test' do
expect(true).to be true
end

最佳答案

您需要将测试包装在一个块中,例如你可以有:

describe 'canary test' do
it 'it true' do
expect(true).to be true
end
end

关于ruby-on-rails - RSpec - WrongScopeError : expect is not available on an example group,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30135038/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com