使用RSpec你有:
spec.rb
describe Magic, "stuff of magic" do
it "should do some crazy magic" do
# crazy magic
end
it "should do some advanced magic"
end
将其作为
运行rspec spec.rb
输出看起来像这样
.*
Pending:
Magic stuff of magic should do some advanced magic
# Not yet implemented
2 examples, 0 failures, 1 pending
现在,您可以使用Shoulda获得某些待处理测试的指示吗?你甚至可以用Shoulda进行待定(尚未实施)的测试吗?
答案 0 :(得分:0)
我不能说我使用这个宝石,rspec
对我来说很好,thoughtbot创建了shoulda
但是......
您仍然可以使用pending
方法,例如
describe Magic, "stuff of magic" do
it { should "do some crazy magic" do
# crazy magic
end
}
it {
should "do some advanced magic" do
pending "someday"
end
}
end
但是还有一个名为should_eventually
的匹配器似乎可以提供此功能
describe Magic, "stuff of magic" do
it "should do some crazy magic" do
# crazy magic
end
it {should_eventually "do some advanced magic"}
end
虽然shoulda
似乎更适合单线测试,例如
it{ should respond_to?(:crazy_magic)}
it{ should allow_value("crazy").for(:type_of_magic)}
it{ should_not allow_value("boring").for(:type_of_magic)}