Make spec a bit more resilient

This commit is contained in:
Luis Ramos
2020-04-17 18:48:20 +01:00
parent 8bd3062b16
commit c33352904a

View File

@@ -24,10 +24,7 @@ feature '
order_cycle: order_cycle, state: 'complete',
payment_state: 'balance_due')
end
let(:customer) do
create(:customer, enterprise: distributor, email: user.email,
user: user, ship_address: create(:address))
end
let(:customer) { order.customer }
before do
# ensure order has a payment to capture
@@ -242,11 +239,9 @@ feature '
end
scenario "shows the order non-tax adjustments" do
within('table.index tbody') do
order.adjustments.eligible.each do |adjustment|
expect(page).to have_selector "td", match: :first, text: adjustment.label
expect(page).to have_selector "td.total", text: adjustment.display_amount
end
order.adjustments.eligible.each do |adjustment|
expect(page).to have_selector "td", match: :first, text: adjustment.label
expect(page).to have_selector "td.total", text: adjustment.display_amount
end
end
@@ -362,12 +357,13 @@ feature '
scenario "editing shipping fees" do
click_link "Adjustments"
page.find('td.actions a.icon-edit').click
shipping_adjustment_tr_selector = "tr#spree_adjustment_#{order.adjustments.shipping.first.id}"
page.find("#{shipping_adjustment_tr_selector} td.actions a.icon-edit").click
fill_in "Amount", with: "5"
click_button "Continue"
expect(page.find("td.amount")).to have_content "5.00"
expect(page.find("#{shipping_adjustment_tr_selector} td.amount")).to have_content "5.00"
end
context "when an included variant has been deleted" do