refactor(spec/system/admin/subscriptions_spec.rb): issue #7483

Add context on third page and adding a product AND deleting the existing product.
This commit is contained in:
paulo-felipe
2023-05-12 22:03:29 -03:00
parent b0623ab4de
commit 5776bdb31c

View File

@@ -345,7 +345,7 @@ describe 'Subscriptions' do
end
end
context 'and adding a product' do
context 'with a product' do
before { add_variant_to_subscription test_variant, 2 }
it 'has description, price estimates, quantity and total' do
@@ -357,6 +357,23 @@ describe 'Subscriptions' do
expect(page).to have_selector 'td.total', text: "$27.50"
end
end
context 'and deleting the existing product' do
before do
within 'table#subscription-line-items tr.item', match: :first do
find("a.delete-item").click
end
end
it 'has content Please add at least one product and subscription does not change' do
click_button('Next')
expect{
click_button('Create Subscription')
expect(page).to have_content 'Please add at least one product'
}.to_not change(Subscription, :count)
end
end
end
end