【发布时间】:2015-11-18 10:26:34
【问题描述】:
在我的 Gemfile 中
gem 'rspec-rails', '~> 3.3'
我发现,errors_on 匹配器移到了另一个 gem:https://github.com/rspec/rspec-collection_matchers
我很肯定在 RSpec 3 中必须有一种方法来实现这一点。
如何将 RSpec 2 have().errors_on 匹配器转换为 RSpec 3?
expect {
click_button(I18n.t('helpers.submit.accounting.update'))
}.to have(4).errors_on(:share_ksk, :central_office, :limit_value, :fix_disagio)
我试过了:
expect {
click_button(I18n.t('helpers.submit.accounting.update'))
}.to have_validation_error(I18n.t('accounting.two_digits_after_decimal_point')).on(
:share_ksk,
:central_office,
:limit_value,
:fix_disagio)
关于https://github.com/rspec/rspec-rails/issues/1033
但我收到一个 RSpec 错误:
undefined method `on' for #<RSpec::Matchers::BuiltIn::Has:0x00000005913368>
【问题讨论】:
-
我不知道你可以在一个块上调用 RSpec 2 匹配器。
标签: rspec rspec-rails rspec3