否定assert_difference?

时间:2011-01-04 17:02:36

标签: ruby-on-rails ruby testing functional-testing

我正在进行功能测试,刚刚发现了assert_difference,如:

assert_difference('Account.count') do
  post :create, :account => @account.attributes
end

是否有对应方,会检查 Account.count 是否已更改?

1 个答案:

答案 0 :(得分:1)

assert_no_difference(expression, message = nil, &block)

From the docs:“断言在调用传入的块之前和之后,不会更改计算表达式的数值结果。”