diff --git a/app/controllers/bikes_controller.rb b/app/controllers/bikes_controller.rb index 8f9f19e..27d01b1 100644 --- a/app/controllers/bikes_controller.rb +++ b/app/controllers/bikes_controller.rb @@ -48,7 +48,7 @@ class BikesController < ApplicationController def update if @bike.update(bike_params) - redirect_to @bike, notice: 'Bike was successfully updated.' + redirect_to edit_bike_path(@bike), notice: 'Bike was successfully updated.' else render action: 'edit' end diff --git a/notes.md b/notes.md index 37e8def..4811f5c 100644 --- a/notes.md +++ b/notes.md @@ -8,6 +8,7 @@ - restyle agencies page to not have show or destroy links # Tech +- bike date_sold column should be datetime - remove bike#entry_date column because it is now fixed_at - add tests to ensure that pages render - use log number in bike url instead of id diff --git a/spec/controllers/bikes_controller_spec.rb b/spec/controllers/bikes_controller_spec.rb index 92d9930..160f3c7 100644 --- a/spec/controllers/bikes_controller_spec.rb +++ b/spec/controllers/bikes_controller_spec.rb @@ -55,4 +55,11 @@ describe BikesController do expect(assigns(:next_bike)).to eq(@next_bike) end end + + describe "#update" do + it "redirects to edit bike path when bike is updated" do + bike = create :bike + expect( put :update, id: bike.id, bike: {brand: "foobar"} ).to redirect_to action: :edit, id: assigns(:bike).id + end + end end