From 4e29589be0ee624d43d983c9d999356bc78488ea Mon Sep 17 00:00:00 2001 From: Hugo Daniel Date: Tue, 13 Nov 2018 15:58:23 +0100 Subject: [PATCH 1/2] Add specs for cloning a product with image --- .../spree/api/products_controller_spec.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spec/controllers/spree/api/products_controller_spec.rb b/spec/controllers/spree/api/products_controller_spec.rb index b3d518a9da..29d30bf01f 100644 --- a/spec/controllers/spree/api/products_controller_spec.rb +++ b/spec/controllers/spree/api/products_controller_spec.rb @@ -8,6 +8,7 @@ module Spree let(:supplier2) { create(:supplier_enterprise) } let!(:product1) { create(:product, supplier: supplier) } let(:product_other_supplier) { create(:product, supplier: supplier2) } + let(:product_with_image) { create(:product_with_image, supplier: supplier) } let(:attributes) { [:id, :name, :supplier, :price, :on_hand, :available_on, :permalink_live] } let(:current_api_user) { build_stubbed(:user) } @@ -144,6 +145,12 @@ module Spree spree_post :clone, product_id: product1.id, format: :json expect(json_response['name']).to eq("COPY OF #{product1.name}") end + + it 'clones a product with image' do + spree_post :clone, product_id: product_with_image.id, format: :json + expect(response.status).to eq(201) + expect(json_response['name']).to eq("COPY OF #{product_with_image.name}") + end end context 'as an administrator' do @@ -162,6 +169,12 @@ module Spree spree_post :clone, product_id: product1.id, format: :json expect(json_response['name']).to eq("COPY OF #{product1.name}") end + + it 'clones a product with image' do + spree_post :clone, product_id: product_with_image.id, format: :json + expect(response.status).to eq(201) + expect(json_response['name']).to eq("COPY OF #{product_with_image.name}") + end end end end From d060704e8676365849edfbe1256459fdf9492140 Mon Sep 17 00:00:00 2001 From: Hugo Daniel Date: Thu, 15 Nov 2018 14:43:13 +0100 Subject: [PATCH 2/2] Change Spree step-6a commit reference in Gemfile --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 84cd7beefb..4bc5c01091 100644 --- a/Gemfile +++ b/Gemfile @@ -13,7 +13,7 @@ gem 'nokogiri', '>= 1.6.7.1' gem 'web', path: './engines/web' gem 'pg' -gem 'spree', github: 'openfoodfoundation/spree', branch: 'step-6a', ref: '69db1c090f3711088d84b524f1b94d25e6d21616' +gem 'spree', github: 'openfoodfoundation/spree', branch: 'step-6a', ref: '41906362d931695e0616194341a68d2c4c85aaaf' gem 'spree_i18n', github: 'spree/spree_i18n', branch: '1-3-stable' gem 'spree_auth_devise', github: 'openfoodfoundation/spree_auth_devise', branch: 'spree-upgrade-intermediate' diff --git a/Gemfile.lock b/Gemfile.lock index 42be519371..5e4a0d6110 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -31,8 +31,8 @@ GIT GIT remote: https://github.com/openfoodfoundation/spree.git - revision: 69db1c090f3711088d84b524f1b94d25e6d21616 - ref: 69db1c090f3711088d84b524f1b94d25e6d21616 + revision: 41906362d931695e0616194341a68d2c4c85aaaf + ref: 41906362d931695e0616194341a68d2c4c85aaaf branch: step-6a specs: spree (1.3.99)