【发布时间】:2015-05-04 21:49:29
【问题描述】:
在我的Dashboard#Index 中,我有这个:
def index
tagged_nodes = Node.includes(:user_tags).tagged_with(current_user.email)
end
如何使用 RSpec 进行测试?
我试过了:
expect(assigns(tagged_nodes)).to match Node.includes(:user_tags).tagged_with(u1.email)
但这给了我这个错误:
NameError:
undefined local variable or method `tagged_nodes' for #<RSpec::ExampleGroups::DashboardController::GETIndex:0x007fe4edd7f058>
【问题讨论】:
标签: ruby-on-rails ruby ruby-on-rails-4 rspec