【发布时间】:2012-09-25 20:14:12
【问题描述】:
我有以下
it 'should assign a new profile to user' do
get :new
assigns(:user_profile).should ==(Profile.new)
end
但它不起作用。我试过'eql?'和“平等?”分别。我如何比较它才能知道@user_profile 的内容是否是Profile.new?
我曾经做过一种变通方法,对分配的变量进行 .class 处理,检查它是否是 Profile,但我想停止这些不良做法。
谢谢。
【问题讨论】:
标签: ruby-on-rails ruby rspec ruby-on-rails-3.2