Skip to content

Commit 498b97e

Browse files
committed
try VCR with plaid_accounts_fetch call
1 parent caa6090 commit 498b97e

File tree

2 files changed

+60
-9
lines changed

2 files changed

+60
-9
lines changed

test/cassettes/plaid_accounts/plaid_accounts_fetch_success.yml

Lines changed: 55 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/lunchmoney/plaid_accounts/plaid_account_calls_test.rb

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class PlaidAccountCallsTest < ActiveSupport::TestCase
99

1010
test "plaid_accounts returns an array of PlaidAccount objects on success response" do
1111
response = mock_faraday_response(fake_plaid_accounts_call)
12-
1312
LunchMoney::PlaidAccountCalls.any_instance.stubs(:get).returns(response)
1413

1514
api_call = LunchMoney::PlaidAccountCalls.new.plaid_accounts
@@ -19,7 +18,6 @@ class PlaidAccountCallsTest < ActiveSupport::TestCase
1918

2019
test "plaid_accounts returns an array of Error objects on error response" do
2120
response = mock_faraday_response(fake_general_error)
22-
2321
LunchMoney::PlaidAccountCalls.any_instance.stubs(:get).returns(response)
2422

2523
api_call = LunchMoney::PlaidAccountCalls.new.plaid_accounts
@@ -28,18 +26,16 @@ class PlaidAccountCallsTest < ActiveSupport::TestCase
2826
end
2927

3028
test "plaid_accounts_fetch returns a boolean response on success" do
31-
response = mock_faraday_response(true)
32-
33-
LunchMoney::PlaidAccountCalls.any_instance.stubs(:post).returns(response)
29+
VCR.use_cassette("plaid_accounts/plaid_accounts_fetch_success") do
30+
ensure_correct_api_key
31+
api_call = LunchMoney::PlaidAccountCalls.new.plaid_accounts_fetch
3432

35-
api_call = LunchMoney::PlaidAccountCalls.new.plaid_accounts_fetch
36-
37-
assert_kind_of(TrueClass, api_call)
33+
assert_kind_of(FalseClass, api_call)
34+
end
3835
end
3936

4037
test "plaid_accounts_fetch returns an array of Error objects on error response" do
4138
response = mock_faraday_response(fake_general_error)
42-
4339
LunchMoney::PlaidAccountCalls.any_instance.stubs(:post).returns(response)
4440

4541
api_call = LunchMoney::PlaidAccountCalls.new.plaid_accounts_fetch

0 commit comments

Comments
 (0)