From 4e07941f0cddd1964af8954b10594a43c616721b Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Fri, 26 Jun 2015 17:42:42 +0300 Subject: [PATCH] Add bank statement create test #2733 --- app/views/admin/invoices/new.haml | 2 +- spec/features/admin/bank_statement_spec.rb | 52 ++++++++++++++++++++++ spec/features/admin/invoice_spec.rb | 2 +- 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 spec/features/admin/bank_statement_spec.rb diff --git a/app/views/admin/invoices/new.haml b/app/views/admin/invoices/new.haml index a799b4468..3b10341af 100644 --- a/app/views/admin/invoices/new.haml +++ b/app/views/admin/invoices/new.haml @@ -30,4 +30,4 @@ %hr .row .col-md-8.text-right - = button_tag(t(:add), class: 'btn btn-warning') + = button_tag(t(:save), class: 'btn btn-warning') diff --git a/spec/features/admin/bank_statement_spec.rb b/spec/features/admin/bank_statement_spec.rb new file mode 100644 index 000000000..bca3136fb --- /dev/null +++ b/spec/features/admin/bank_statement_spec.rb @@ -0,0 +1,52 @@ +require 'rails_helper' + +feature 'BankStatement', type: :feature do + before :all do + @user = Fabricate(:admin_user) + end + + before do + sign_in @user + end + + it 'should add a bank statement and transactions manually' do + visit admin_bank_statements_url + + click_link 'Add' + fill_in 'Bank code', with: '767' + fill_in 'Iban', with: 'EE557700771000598731' + click_button 'Save' + + page.should have_content('Record created') + page.should have_content('Bank statement ') + page.should have_content('767') + page.should have_content('EE557700771000598731') + page.should have_content('Not binded') + + click_link 'Add' + fill_in 'Description', with: 'Payment 12345' + fill_in 'Sum', with: '120' + fill_in 'Reference no', with: 'RF4663930489' + fill_in 'Document no', with: '123' + fill_in 'Bank reference', with: '767' + fill_in 'Iban', with: 'EE557700771000598731' + fill_in 'Buyer bank code', with: '767' + fill_in 'Buyer iban', with: 'EE557700771000598000' + fill_in 'Buyer name', with: 'Test buyer' + fill_in 'Paid at', with: '2015-01-01' + + click_button 'Save' + + page.should have_content('Record created') + page.should have_content('Bank transaction') + page.should have_content('RF4663930489') + page.should have_content('EE557700771000598000') + page.should have_content('Not binded') + page.should have_content('Bind manually') + + click_link 'Back to bank statement' + + page.should have_content('120.0') + page.should have_content('Test buyer') + end +end diff --git a/spec/features/admin/invoice_spec.rb b/spec/features/admin/invoice_spec.rb index 4c5640d7c..4e3747373 100644 --- a/spec/features/admin/invoice_spec.rb +++ b/spec/features/admin/invoice_spec.rb @@ -35,7 +35,7 @@ feature 'Invoice', type: :feature do select r.name, from: 'Registrar' fill_in 'Amount', with: '100' fill_in 'Description', with: 'test issue' - click_button 'Add' + click_button 'Save' page.should have_content('Record created') page.should have_content('Invoice no.') page.should have_content('Prepayment')