0
我怎麼能翻番@user
VAR方法中我怎樣才能加倍的變量,如果我不加倍,測試將拋出的零的在rspec的軌道
呼叫update_attributes方法錯誤:NilClass
class TestController
def foo!
@user = current_user
@user.update_attribute(user_params)
end
end
RSpec.describe TestController, type: :controller do
describe "#foo" do
it "should be passed" do
@specific_user = FactoryGirl.create(:user)
allow_any_instance_of(TestController).to receive(:foo!).and_return(true)
allow_any_instance_of(TestController).to receive(@user).and_return(@specific_user)
end
end
end