【问题标题】:Ruby Rspec, 'Let' not being accepted as available within example group RspecRuby Rspec,“让”不被接受为示例组 Rspec 中的可用
【发布时间】:2021-02-06 08:38:19
【问题描述】:

我在 Rspec 接受我的 let 定义之一的范围时遇到了一些问题。

这是我的测试,所有课程都运行良好,因为当我将它们打印出来时,它们很甜。

code removed due to silly error

提前致谢!

【问题讨论】:

    标签: ruby testing rspec scope


    【解决方案1】:

    您的it 块缺少doend

        describe "Initialisation of order within User object" do
          it "Creates an order property set to an empty array" do
            expect(user.instance_variable_defined?(:@orders)).to be(true)
            expect(user.instance_variable_get(:@orders)).to eq([])
          end
        end
    

    【讨论】:

    • :| ...我不敢相信我错过了。
    • 谢谢@pixelearth,你是最棒的
    • 别忘了将答案标记为已接受;)
    猜你喜欢
    • 1970-01-01
    • 2011-07-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多