Skip to content

armgit / spree

Public Imported from GitHub
0

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.

Fixed flaky specs (#11215)

Damian Legawiece4d130675b06
diff --git a/api/spec/serializers/spree/api/v2/platform/taxonomy_serializer_spec.rb b/api/spec/serializers/spree/api/v2/platform/taxonomy_serializer_spec.rb
index 107f2177bb..5198bbb1e0 100644
--- a/api/spec/serializers/spree/api/v2/platform/taxonomy_serializer_spec.rb
+++ b/api/spec/serializers/spree/api/v2/platform/taxonomy_serializer_spec.rb
@@ -4,12 +4,18 @@ describe Spree::Api::V2::Platform::TaxonomySerializer, retry: 3 do
subject { described_class.new(taxonomy) }
let(:taxonomy) { create(:taxonomy) }
- let!(:root) { taxonomy.root }
- let!(:taxon) { create(:taxon, taxonomy: taxonomy) }
+ let(:taxon) { create(:taxon, taxonomy: taxonomy) }
it { expect(subject.serializable_hash).to be_kind_of(Hash) }
it do
+ taxons_json = taxonomy.taxons.map do |taxon|
+ {
+ id: taxon.id.to_s,
+ type: :taxon
+ }
+ end
+
expect(subject.serializable_hash).to eq(
{
data: {
@@ -24,21 +30,12 @@ describe Spree::Api::V2::Platform::TaxonomySerializer, retry: 3 do
relationships: {
root: {
data: {
- id: root.id.to_s,
+ id: taxonomy.root.id.to_s,
type: :taxon
}
},
taxons: {
- data: [
- {
- id: root.id.to_s,
- type: :taxon
- },
- {
- id: taxon.id.to_s,
- type: :taxon
- }
- ]
+ data: taxons_json
}
}
}
diff --git a/backend/spec/features/admin/promotions/promotion_spec.rb b/backend/spec/features/admin/promotions/promotion_spec.rb
index 65d73dafa7..d63379099b 100644
--- a/backend/spec/features/admin/promotions/promotion_spec.rb
+++ b/backend/spec/features/admin/promotions/promotion_spec.rb
@@ -31,8 +31,9 @@ describe 'Create New Promotion', type: :feature, js: true do
click_button 'Create'
- expect(page).to have_field(id: 'promotion_starts_at', type: :hidden, with: '2012-01-24 16:45')
- expect(page).to have_field(id: 'promotion_expires_at', type: :hidden, with: '2012-01-25 22:10')
+ promotion = store.promotions.last
+ expect(promotion.starts_at).to eq(DateTime.new(2012, 1, 24, 16, 45))
+ expect(promotion.expires_at).to eq(DateTime.new(2012, 1, 25, 22, 10))
end
it 'allows assigning multiple stores' do