Testing Plaid Item Removal Workflow in Maybe Finance
This test suite validates the PlaidItem model functionality in the Maybe Finance application, focusing on item removal and syncable interface implementation. The tests ensure proper integration with the Plaid API and verify cleanup operations.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
maybe-finance/maybe
test/models/plaid_item_test.rb
require "test_helper"
class PlaidItemTest < ActiveSupport::TestCase
include SyncableInterfaceTest
setup do
@plaid_item = @syncable = plaid_items(:one)
end
test "removes plaid item when destroyed" do
@plaid_provider = mock
PlaidItem.stubs(:plaid_provider).returns(@plaid_provider)
@plaid_provider.expects(:remove_item).with(@plaid_item.access_token).once
assert_difference "PlaidItem.count", -1 do
@plaid_item.destroy
end
end
end