mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-04 07:09:14 +00:00
Merge pull request #3022 from HugsDaniel/2756-duplicate-product-with-image
Add specs for cloning a product with image
This commit is contained in:
2
Gemfile
2
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'
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user