Skip to content

Commit

Permalink
Whoooops!
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszreszke committed Sep 21, 2024
1 parent 6b5fffe commit 42b1228
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion rails_application/app/controllers/products_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ def update
@product.future_price = params["future_price"]["price"]
@product.future_price_start_time = params["future_price"]["start_time"]
@product.save!
else
@product_with_new_price = @product.dup
@product_with_new_price.price = product_params[:price]
@product_with_new_price.save!
end
@product.update!(product_params)
redirect_to products_path, notice: "Product was successfully updated"
end

Expand Down
2 changes: 1 addition & 1 deletion rails_application/test/integration/orders_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def test_order_value_doesnt_change_after_changing_price
update_price(async_remote_id, 49)
get "/orders/#{order_id}"

assert_select("td", text: "$49.00")
assert_select("td", text: "$39.00")
assert_select("td", text: "$78.00")
end

Expand Down

0 comments on commit 42b1228

Please sign in to comment.