【发布时间】:2014-06-10 05:05:05
【问题描述】:
我在 Rails 3.2 上有这个工作测试
it('render messages') { expect(helper.error_message('test')).to render_template('message') }
但是这在 Rails 4 上不起作用,这是消息:
2) ApplicationHelper#error_message render messages
Failure/Error: it('render messages') { expect(helper.error_message('test')).to render_template('message') }
expecting <"message"> but rendering with <["_message"]>
# ./spec/helpers/application_helper_spec.rb:9:in `block (3 levels) in <top (required)>'
我已经在 ActionView 上搜索了可能会影响这一点的更改,但没有找到任何东西。我想知道解决方案是否只是添加_
expect(helper.error_message('test')).to render_template('_message')
或者这样做有什么缺点吗?
【问题讨论】:
标签: testing ruby-on-rails-4 rspec ruby-on-rails-3.2 actionview