From d16d97095213cd7bbba788553ad5a2d0d7a49c2b Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Fri, 4 Apr 2014 14:12:27 +1100 Subject: [PATCH] BPE uses soft-delete --- app/assets/javascripts/admin/bulk_product_update.js.coffee | 2 +- spec/features/admin/bulk_product_update_spec.rb | 4 ++-- spec/javascripts/unit/bulk_product_update_spec.js.coffee | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/admin/bulk_product_update.js.coffee b/app/assets/javascripts/admin/bulk_product_update.js.coffee index c2641615e2..35e66c49ad 100644 --- a/app/assets/javascripts/admin/bulk_product_update.js.coffee +++ b/app/assets/javascripts/admin/bulk_product_update.js.coffee @@ -291,7 +291,7 @@ productEditModule.controller "AdminProductEditCtrl", [ if confirm("Are you sure?") $http( method: "DELETE" - url: "/api/products/" + product.id + "/variants/" + variant.id + url: "/api/products/" + product.permalink_live + "/variants/" + variant.id + "/soft_delete" ).success (data) -> $scope.removeVariant(product, variant) diff --git a/spec/features/admin/bulk_product_update_spec.rb b/spec/features/admin/bulk_product_update_spec.rb index 62d9b53cee..0c8d81bd5c 100644 --- a/spec/features/admin/bulk_product_update_spec.rb +++ b/spec/features/admin/bulk_product_update_spec.rb @@ -609,7 +609,7 @@ feature %q{ visit '/admin/products/bulk_edit' page.should have_selector "a.view-variants" - all("a.view-variants").each{ |e| e.click } + all("a.view-variants").each { |e| e.click } page.should have_selector "a.delete-variant", :count => 3 @@ -620,7 +620,7 @@ feature %q{ visit '/admin/products/bulk_edit' page.should have_selector "a.view-variants" - all("a.view-variants").select{ |e| e.visible? }.each{ |e| e.click } + all("a.view-variants").select { |e| e.visible? }.each { |e| e.click } page.should have_selector "a.delete-variant", :count => 2 end diff --git a/spec/javascripts/unit/bulk_product_update_spec.js.coffee b/spec/javascripts/unit/bulk_product_update_spec.js.coffee index 58a5ce1941..7a452b213a 100644 --- a/spec/javascripts/unit/bulk_product_update_spec.js.coffee +++ b/spec/javascripts/unit/bulk_product_update_spec.js.coffee @@ -1100,7 +1100,7 @@ describe "AdminProductEditCtrl", -> describe "when the variant has been saved", -> - it "deletes variants with a http delete request to /api/products/product_id/variants/(variant_id)", -> + it "deletes variants with a http delete request to /api/products/product_permalink/variants/(variant_id)", -> spyOn(window, "confirm").andReturn true scope.products = [ { @@ -1117,7 +1117,7 @@ describe "AdminProductEditCtrl", -> } ] scope.dirtyProducts = {} - httpBackend.expectDELETE("/api/products/9/variants/3").respond 200, "data" + httpBackend.expectDELETE("/api/products/apples/variants/3/soft_delete").respond 200, "data" scope.deleteVariant scope.products[0], scope.products[0].variants[0] httpBackend.flush() @@ -1159,7 +1159,7 @@ describe "AdminProductEditCtrl", -> id: 13 name: "P1" - httpBackend.expectDELETE("/api/products/9/variants/3").respond 200, "data" + httpBackend.expectDELETE("/api/products/apples/variants/3/soft_delete").respond 200, "data" scope.deleteVariant scope.products[0], scope.products[0].variants[0] httpBackend.flush() expect(scope.products[0].variants).toEqual [