File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
test/integration/admin_area Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ require 'test_helper'
2+
3+ class AdminAreaBankStatementsIntegrationTest < ActionDispatch ::IntegrationTest
4+ include Devise ::Test ::IntegrationHelpers
5+
6+ setup do
7+ sign_in users ( :admin )
8+ @bank_statement = bank_statements ( :one )
9+ end
10+
11+ def test_index_page_accessible
12+ get admin_bank_statements_path
13+ assert_response :success
14+ assert_includes response . body , 'Bank statements'
15+ end
16+
17+ def test_creates_bank_statement
18+ params = {
19+ bank_statement : {
20+ bank_code : '9876' ,
21+ iban : 'GB82WEST12345698765432'
22+ }
23+ }
24+
25+ assert_difference 'BankStatement.count' , +1 do
26+ post admin_bank_statements_path , params : params
27+ end
28+
29+ statement = BankStatement . last
30+ assert_redirected_to admin_bank_statement_path ( statement )
31+ follow_redirect!
32+ assert_response :success
33+ assert_includes flash [ :notice ] , I18n . t ( 'record_created' )
34+ end
35+
36+ def test_bind_invoices_sets_flash_when_nothing_binded
37+ post bind_invoices_admin_bank_statement_path ( @bank_statement )
38+
39+ assert_redirected_to admin_bank_statement_path ( @bank_statement )
40+ follow_redirect!
41+ assert_response :success
42+ assert_equal I18n . t ( 'no_invoices_were_binded' ) , flash [ :alert ]
43+ end
44+ end
You can’t perform that action at this time.
0 commit comments