Refactor spec

Better to explicitly test for the change, and specify expected values.
This commit is contained in:
David Cook
2023-09-20 16:35:12 +10:00
parent a2f8b0db16
commit 3710aa2149

View File

@@ -138,12 +138,11 @@ describe Sets::ProductSet do
it 'updates product and variant attributes' do
collection_hash[0][:sku] = "test_sku"
product_set.save
expect(product.reload.variants.first[:sku]).to eq variants_attributes.first[:sku]
expect(product.reload.attributes).to include(
'sku' => "test_sku"
)
expect {
product_set.save
product.reload
}.to change { product.sku }.to("test_sku")
.and change { product.variants.first.sku }.to("123")
end
end
end