-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Current association in AccountsController and add tests (#298)
* Add PagesControllerTest with authentication * Rubocop fixes * Move sign_in to setup block * Remove instance variable * Add tests for AccountsController * Use specific account
- Loading branch information
1 parent
fb7411e
commit 1cded2a
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require "test_helper" | ||
|
||
class AccountsControllerTest < ActionDispatch::IntegrationTest | ||
setup do | ||
sign_in @user = users(:bob) | ||
@account = accounts(:dylan_checking) | ||
end | ||
|
||
test "new" do | ||
get new_account_path | ||
assert_response :ok | ||
end | ||
|
||
test "show" do | ||
get account_path(@account) | ||
assert_response :ok | ||
end | ||
|
||
test "create" do | ||
assert_difference -> { Account.count }, +1 do | ||
post accounts_path, params: { account: { accountable_type: "Account::Credit" } } | ||
assert_redirected_to accounts_url | ||
end | ||
end | ||
end |