changing view for group_order_invoices
testing ui of goi restructuring
This commit is contained in:
parent
de6643722a
commit
90c5450525
52 changed files with 783 additions and 57 deletions
|
|
@ -1,6 +1,6 @@
|
|||
require_relative '../spec_helper'
|
||||
|
||||
feature GroupOrderInvoice, js: true do
|
||||
feature GroupOrderInvoice, type: :feature, js: true do
|
||||
let(:admin) { create :user, groups: [create(:workgroup, role_finance: true)] }
|
||||
let(:user) { create :user, groups: [create(:ordergroup)] }
|
||||
let(:article) { create :article, unit_quantity: 1 }
|
||||
|
|
@ -35,7 +35,7 @@ feature GroupOrderInvoice, js: true do
|
|||
click_link_or_button I18n.t('finance.balancing.confirm.clear')
|
||||
expect(NotifyGroupOrderInvoiceJob).to have_been_enqueued
|
||||
end
|
||||
|
||||
|
||||
it 'generates Group Order Invoice when order is closed if tax_number is set' do
|
||||
goa.update_quantities 2, 0
|
||||
oa.update_results!
|
||||
|
|
@ -44,6 +44,7 @@ feature GroupOrderInvoice, js: true do
|
|||
go.reload
|
||||
order.reload
|
||||
visit finance_order_index_path
|
||||
click_link_or_button 'Toggle details'
|
||||
expect(page).to have_selector(:link_or_button, I18n.t('activerecord.attributes.group_order_invoice.links.generate'))
|
||||
click_link_or_button I18n.t('activerecord.attributes.group_order_invoice.links.generate')
|
||||
expect(GroupOrderInvoice.all.count).to eq(1)
|
||||
|
|
@ -56,7 +57,10 @@ feature GroupOrderInvoice, js: true do
|
|||
order.update!(state: 'closed')
|
||||
order.reload
|
||||
visit finance_order_index_path
|
||||
click_link_or_button 'Toggle details'
|
||||
|
||||
expect(page).to have_selector(:link_or_button, I18n.t('activerecord.attributes.group_order_invoice.links.generate_with_date'))
|
||||
|
||||
click_link_or_button I18n.t('activerecord.attributes.group_order_invoice.links.generate_with_date')
|
||||
expect(GroupOrderInvoice.all.count).to eq(1)
|
||||
end
|
||||
|
|
@ -69,4 +73,35 @@ feature GroupOrderInvoice, js: true do
|
|||
visit finance_order_index_path
|
||||
expect(page).to have_content(I18n.t('activerecord.attributes.group_order_invoice.tax_number_not_set'))
|
||||
end
|
||||
|
||||
it 'shows info message instead of sepa download link', js: true do
|
||||
goa.update_quantities 2, 0
|
||||
oa.update_results!
|
||||
FoodsoftConfig[:group_order_invoices] = { use_automatic_invoices: true }
|
||||
FoodsoftConfig[:contact][:tax_number] = 12_345_678
|
||||
order.update!(state: 'closed')
|
||||
order.reload
|
||||
visit finance_order_index_path
|
||||
sleep 2
|
||||
click_link_or_button 'Toggle details'
|
||||
click_link_or_button I18n.t('activerecord.attributes.group_order_invoice.links.generate')
|
||||
expect(page).to have_content(I18n.t('activerecord.attributes.group_order_invoice.links.sepa_not_ready'))
|
||||
end
|
||||
|
||||
it 'shows sepa download link', js: true do
|
||||
goa.update_quantities 2, 0
|
||||
oa.update_results!
|
||||
FoodsoftConfig[:group_order_invoices] = { use_automatic_invoices: true, bic: "a", iban: "b", creditor_identifier: "c" }
|
||||
FoodsoftConfig[:contact][:tax_number]= 12_345_678
|
||||
FoodsoftConfig[:name] = "Foodsoft"
|
||||
order.update!(state: 'closed')
|
||||
order.reload
|
||||
visit finance_order_index_path
|
||||
sleep 2
|
||||
click_link_or_button 'Toggle details'
|
||||
click_link_or_button I18n.t('activerecord.attributes.group_order_invoice.links.generate')
|
||||
sleep 1
|
||||
expect(page).to have_selector(:link_or_button, "collective-direct-debit-link-#{order.id}")
|
||||
expect(page).to have_selector(".ajax-update-all-link-#{order.id}")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ RSpec.configure do |config|
|
|||
# --seed 1234
|
||||
config.order = 'random'
|
||||
|
||||
config.include SepaHelper
|
||||
|
||||
config.include SpecTestHelper, type: :controller
|
||||
config.include SessionHelper, type: :feature
|
||||
# Automatically determine spec from directory structure, see:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue