require "test_helper" class PriceReportsControllerTest < ActionDispatch::IntegrationTest setup do @price_report = price_reports(:one) end test "should get index" do get price_reports_url, as: :json assert_response :success end test "should create price_report" do assert_difference("PriceReport.count") do post price_reports_url, params: { price_report: { discount_price: @price_report.discount_price, downvotes: @price_report.downvotes, guest_id: @price_report.guest_id, price: @price_report.price, product_id: @price_report.product_id, reported_at: @price_report.reported_at, store_id: @price_report.store_id, upvotes: @price_report.upvotes } }, as: :json end assert_response :created end test "should show price_report" do get price_report_url(@price_report), as: :json assert_response :success end test "should update price_report" do patch price_report_url(@price_report), params: { price_report: { discount_price: @price_report.discount_price, downvotes: @price_report.downvotes, guest_id: @price_report.guest_id, price: @price_report.price, product_id: @price_report.product_id, reported_at: @price_report.reported_at, store_id: @price_report.store_id, upvotes: @price_report.upvotes } }, as: :json assert_response :success end test "should destroy price_report" do assert_difference("PriceReport.count", -1) do delete price_report_url(@price_report), as: :json end assert_response :no_content end end