-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from halorrr/plaid_accounts_call
finish plaid_accounts call
- Loading branch information
Showing
3 changed files
with
91 additions
and
4 deletions.
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
29 changes: 29 additions & 0 deletions
29
test/lunchmoney/plaid_accounts/plaid_account_calls_test.rb
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,29 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
require "test_helper" | ||
|
||
class PlaidAccountCallsTest < ActiveSupport::TestCase | ||
include MockResponseHelper | ||
include FakeResponseDataHelper | ||
|
||
test "plaid_accounts returns an array of PlaidAccount objects on success response" do | ||
response = mock_faraday_response(fake_plaid_accounts_call) | ||
|
||
LunchMoney::PlaidAccountCalls.any_instance.stubs(:get).returns(response) | ||
|
||
api_call = LunchMoney::PlaidAccountCalls.new.plaid_accounts | ||
|
||
assert_kind_of(LunchMoney::PlaidAccount, api_call.first) | ||
end | ||
|
||
test "plaid_accounts returns an array of Error objects on error response" do | ||
response = mock_faraday_response(fake_general_error) | ||
|
||
LunchMoney::PlaidAccountCalls.any_instance.stubs(:get).returns(response) | ||
|
||
api_call = LunchMoney::PlaidAccountCalls.new.plaid_accounts | ||
|
||
assert_kind_of(LunchMoney::Error, api_call.first) | ||
end | ||
end |