I am new to Rails and have started working on a new project. But i am unable to find the exact solution for my Update controller this is my update controller.
def update
respond_to do |format|
if @wallet.update(wallet_params)
format.html { redirect_to @wallet, notice: 'Wallet was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @wallet.errors, status: :unprocessable_entity }
end
end
end
In my wallets table i have id,user_id,balance,name. I have tried
describe "PUT #update" do
it "should update the wallet" do
put :update, id :@wallet.id :wallet{ :name => "xyz", :balance => "20.2"}
end
end
Have even tried few things RSpec test PUT update action and How to write an RSpec test for a simple PUT update? but still not able to solve the problem.