加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Rails测试:断言渲染动作

发布时间:2020-12-16 20:32:45 所属栏目:百科 来源:网络整理
导读:我如何写一个测试来断言动作新的呈现? def method ... render :action = :newend 我正在寻找类似下面的行,但要断言该动作被调用,而不是模板: assert_equal layout,@response.layoutassert_equal format,@request.format 我知道我不能做@ response.action
我如何写一个测试来断言动作新的呈现?
def method
  ...
  render :action => :new
end

我正在寻找类似下面的行,但要断言该动作被调用,而不是模板:

assert_equal layout,@response.layout
assert_equal format,@request.format

我知道我不能做@ response.action

提前致谢!

德布

解决方法

视图将被呈现,所谓的动作.
尝试这个:
@controller.expects(:new)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读