Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
improve tests for values on change of type
Matthew Kennedy276e8db6e885
diff --git a/core/spec/models/spree/cms/sections/image_gallery_spec.rb b/core/spec/models/spree/cms/sections/image_gallery_spec.rbindex 0f7985e7c6..c35250f2e2 100644--- a/core/spec/models/spree/cms/sections/image_gallery_spec.rb+++ b/core/spec/models/spree/cms/sections/image_gallery_spec.rb@@ -77,9 +77,23 @@ describe Spree::Cms::Sections::ImageGallery, type: :model dosection.reloadend+ it 'link_one, link_two and save the initail values' do+ section = Spree::CmsSection.find(image_gallery_section.id)++ expect(section.link_one).to eql 'Shirt 1'+ expect(section.link_two).to eql 'Shirt 2'+ expect(section.link_three).to eql 'Shirt 3'+ end+it 'link_one, link_two and link_three are reset to nil' dosection = Spree::CmsSection.find(image_gallery_section.id)+ section.content[:link_type_one] = 'Spree::Taxon'+ section.content[:link_type_two] = 'Spree::Taxon'+ section.content[:link_type_three] = 'Spree::Taxon'+ section.save!+ section.reload+expect(section.link_one).to be nilexpect(section.link_two).to be nilexpect(section.link_three).to be nildiff --git a/core/spec/models/spree/cms/sections/side_by_side_images_spec.rb b/core/spec/models/spree/cms/sections/side_by_side_images_spec.rbindex 6059b2f207..6044edbe19 100644--- a/core/spec/models/spree/cms/sections/side_by_side_images_spec.rb+++ b/core/spec/models/spree/cms/sections/side_by_side_images_spec.rb@@ -63,9 +63,21 @@ describe Spree::Cms::Sections::SideBySideImages, type: :model dosection.reloadend- it 'link_one and link_two are reset to nil' do+ it 'link_one and link_two save the values correctly' dosection = Spree::CmsSection.find(side_by_side_images_section.id)+ expect(section.link_one).to eql 'Shirt 1'+ expect(section.link_two).to eql 'Shirt 2'+ end++ it 'link_one and link_two are reset to nil when type is changed' do+ section = Spree::CmsSection.find(side_by_side_images_section.id)++ section.content[:link_type_one] = 'Spree::Taxon'+ section.content[:link_type_two] = 'Spree::Taxon'+ section.save!+ section.reload+expect(section.link_one).to be nilexpect(section.link_two).to be nilend