gpt4 book ai didi

ruby - RSpec 不允许挂起的方法

转载 作者:数据小太阳 更新时间:2023-10-29 08:34:42 28 4
gpt4 key购买 nike

当我尝试使用 RSpec 定义(但不实现 it 测试)(待定方法)时

describe "test" do
it "should not fail, but does"
end

当我尝试运行时出现此错误

ArgumentError in 'should not fail, but does'
wrong number of arguments (1 for 0)

有人知道为什么会这样吗?难道我做错了什么? (我使用的是 Ruby 1.9.2 和 RSpec 1.3.0)。有人可以帮我解决这个问题吗?

最佳答案

哇,好奇怪。我能够用 Ruby 1.9.2 复制你的问题。不知道为什么会这样,但这可以让您有一个适当的未决规范:

class Foo
end

describe Foo do
# This fails in Ruby 1.9.2 but works in 1.8.7
it "is pending"

# This works in both
it "is pending" do
pending
end
end

rspec 2.0.0 似乎解决了 1.9.2 的问题。

关于ruby - RSpec 不允许挂起的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3712644/

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