mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user