Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
DatabaseCleaner.clean_with :truncation
end

# Around each spec check if it is a Javascript test and switch between using
# database transactions or not where necessary.
config.around(:each) do |example|
DatabaseCleaner.strategy = RSpec.current_example.metadata[:js] ? :truncation : :transaction
DatabaseCleaner.cleaning { example.run }
# Set database cleaner strategy before test data is created
config.before(:each) do |example|
DatabaseCleaner.strategy = example.metadata[:js] ? :truncation : :transaction
DatabaseCleaner.start
end

config.after(:each) do
DatabaseCleaner.clean
end
end
4 changes: 4 additions & 0 deletions templates/spec/system/coupon_code_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ def create_basic_coupon_promotion(code)

# To shipping method screen
click_button "Save and Continue"
expect(page).to have_content("Shipping Method")
# To payment screen
click_button "Save and Continue"
expect(page).to have_content("Payment Information")
end

it "informs about an invalid coupon code" do
Expand Down Expand Up @@ -102,8 +104,10 @@ def create_basic_coupon_promotion(code)
# To shipping method screen, address is auto-populated
# with user's saved addresses
click_button "Save and Continue"
expect(page).to have_content("Shipping Method")
# To payment screen
click_button "Save and Continue"
expect(page).to have_content("Payment Information")
end

it "shows wallet payments on coupon code errors" do
Expand Down