1

使用shouldawithunit/test我有一个上下文,它需要一个测试在其他测试被尝试之前通过。

有没有我可以调用的方法会在当前上下文中使所有后续测试失败?或者甚至不运行它们?

我在想像:

context "My thing" do
  setup do
    my_variable = false
  end

  should "have my_variable as true" do
    assert_or_contextflunk my_variable
  end
end

(显然这是一个毫无意义的例子,但你明白我在做什么)

4

1 回答 1

0

将待处理块添加到您的设置方法。

setup do
  pending ('This will be tested later')
  my_variable = false
end

请参阅http://rspec.info/documentation/的待处理示例部分了解更多信息。

于 2010-08-30T14:35:28.223 回答