【发布时间】:2015-10-29 22:32:36
【问题描述】:
我正在尝试测试布局中包含的部分内容。以下是我的设置。
我有一个基于其他几个控制器的基本控制器。
BaseController < ApplciationController
layout 'base'
end
因此,在base 布局中,我包含了部分_my_partial。如果布局呈现部分,我不确定如何测试。
例如:我可以从基本控制器继承的控制器动作规范中对其进行测试。
UsersController < BaseController
def index
end
end
#users controller spec #index action
get :index
response.should render_template(:partial => "_my_partial")
但这在我看来有点奇怪,因为我实际上想测试部分 in 是否包含在每个继承它的控制器中。我认为这个测试并不意味着这一点。
关于如何编写这个规范的任何想法?
【问题讨论】:
标签: ruby-on-rails testing rspec rspec3