fix one flaky test

This commit is contained in:
viehlieb 2023-10-13 19:03:55 +02:00
parent 03884e83a3
commit 8f05dd440e
10 changed files with 89 additions and 37 deletions

View file

@ -14,25 +14,32 @@ feature 'settling an order', js: true do
let(:goa2) { create(:group_order_article, group_order: go2, order_article: oa) }
before do
Rails.cache.clear
login admin
goa1.update_quantities(3, 0)
goa2.update_quantities(1, 0)
oa.update_results!
oa.reload
order.reload
order.finish!(admin)
goa1.reload
goa2.reload
visit new_finance_order_path(order_id: order.id)
end
before { visit new_finance_order_path(order_id: order.id) }
before { login admin }
after do
Rails.cache.clear
end
it 'has correct order result' do
oa.reload
expect(oa.quantity).to eq(4)
expect(oa.tolerance).to eq(0)
expect(goa1.result).to eq(3)
expect(goa2.result).to eq(1)
end
it 'has product ordered visible' do
it 'has product ordered visible', js: true do
expect(page).to have_content(article.name)
expect(page).to have_selector("#order_article_#{oa.id}")
end

View file

@ -170,8 +170,10 @@ describe Order do
oa.update_results!
order.finish!(user)
goa.reload
order.reload
order.close!(user, ftt)
goa.reload
end
it 'creates financial transaction with correct amount' do

View file

@ -40,6 +40,13 @@ RSpec.configure do |config|
FoodsoftConfig.init_mailing
end
config.before(:each, type: :feature) do
Rails.cache.clear
end
config.after(:each, type: :feature) do
Rails.cache.clear
end
# If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of
# rspec-rails.