Convert calls to xhr to post or put with xhr: true

This commit is contained in:
Luis Ramos
2021-03-13 12:08:10 +00:00
parent 58c3c49cfb
commit f710bbed3e
4 changed files with 11 additions and 11 deletions

View File

@@ -19,14 +19,14 @@ module Api
let(:current_api_user) { create(:admin_user) }
it "saves a new image when none is present" do
xhr :post, :update_product_image, product_id: product_without_image.id, file: image, use_route: :product_images
post :update_product_image, xhr: true, params: { product_id: product_without_image.id, file: image, use_route: :product_images }
expect(response.status).to eq 201
expect(product_without_image.images.first.id).to eq json_response['id']
end
it "updates an existing product image" do
xhr :post, :update_product_image, product_id: product_with_image.id, file: image, use_route: :product_images
post :update_product_image, xhr: true, params: { product_id: product_with_image.id, file: image, use_route: :product_images }
expect(response.status).to eq 200
expect(product_with_image.images.first.id).to eq json_response['id']