Pending 无法阻止 CRUD(“get”、“put”、“post”)等辅助方法在 Controller 测试中运行。
it "should update blah..." do
pending "This is pending"
put :update, { :id => @obj.id }
expect(true).to eq(false)
end
这会导致调用“put”,但期望部分不会运行。因此挂起似乎符合预期,但不能阻止帮助程序运行。
我正在使用 rspec 3.1
有什么想法吗?谢谢!
最佳答案
rspec3 中 pending
的语义发生了变化。现在待定意味着规范预计会失败,因此现在会执行待定规范(如果规范通过,则将其标记为失败)
要停止运行规范,请使用skip
。 Myron Marston 在 changes in RSpec 3 上的帖子中有更多信息。
关于ruby-on-rails - 当我将 "pending"放入 rspec Controller 测试中时,它仍然运行 CRUD 帮助程序方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26150694/