User.should_receive(:update_attributes).with({'these' => 'params'})
那声明是什么意思? these
在任何地方都没有被实例化为任何含义。这个默认的RSpec语句是什么意思?
整个声明是这样的:
describe "with valid params" do
it "updates the requested user" do
User.should_receive(:find).with("37") { mock_user }
User.should_receive(:update_attributes).with({'these' => 'params'})
put :update, :id => "37", :user => {'these' => 'params'}
end
我这样说是因为我发现了一个错误:
unknown attribute: these
这是从上述情景来..
对,但是这些是什么和什么是参数? – Trip 2010-09-09 00:30:10
这只是一个示例散列。你可以用你的控制器所期望的来代替它。例如,你可能正在更新用户的名字,所以它会是'with({:first_name =>“something”,:last_name =>“else”})' – 2010-09-09 00:43:54