阅读背景:

将局部变量作为参数传递给RSpec shared_examples始终为Nil

来源:互联网 

I have a spec like this:

我有这样的规格:

shared_examples_for 'using the id' do |the_id|
    it 'should do something with the id' do
        # do something with the_id
    end
end

id = nil
describe 'a spec' do
    it 'should retrieve id' do
        id = getId
        expect(id).to eq(12345)
    end
    include_examples 'using the id', id
end
shared_ex



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: