spec/plaid_spec.rb in plaid-1.1.0 vs spec/plaid_spec.rb in plaid-1.1.1
- old
+ new
@@ -139,10 +139,80 @@
p.environment_location = 'https://tartan.plaid.com/'
end
user = Plaid.add_user('connect','plaid_selections', 'plaid_locked','wells')
it { expect(user.api_res).to eq 'User account is locked' }
end
+
+ context 'enters webhook option as part of standard call' do
+ Plaid.config do |p|
+ p.customer_id = 'test_id'
+ p.secret = 'test_secret'
+ p.environment_location = 'https://tartan.plaid.com/'
+ end
+ user = Plaid.add_user('connect','plaid_test', 'plaid_good','wells',{login_only: true, webhook: 'test.com/test.endpoint.aspx'})
+ it { expect(user.accounts.empty?).to be_falsey }
+ end
+
+ context 'enters webhook option as part of mfa required institution authentication' do
+ Plaid.config do |p|
+ p.customer_id = 'test_id'
+ p.secret = 'test_secret'
+ p.environment_location = 'https://tartan.plaid.com/'
+ end
+ user = Plaid.add_user('connect','plaid_selections', 'plaid_good','bofa',{login_only: true, webhook: 'test.com/test.endpoint.aspx'})
+ it { expect(user.api_res).to eq 'Requires further authentication' }
+ end
+
+ context 'requests pending transactions from an institution' do
+ Plaid.config do |p|
+ p.customer_id = 'test_id'
+ p.secret = 'test_secret'
+ p.environment_location = 'https://tartan.plaid.com/'
+ end
+ user = Plaid.add_user('connect','plaid_selections', 'plaid_locked','wells',{pending: true})
+ it { expect(user.accounts.empty?).to be_falsey }
+ end
+
+ context 'sets the login only option to true' do
+ Plaid.config do |p|
+ p.customer_id = 'test_id'
+ p.secret = 'test_secret'
+ p.environment_location = 'https://tartan.plaid.com/'
+ end
+ user = Plaid.add_user('connect','plaid_selections', 'plaid_locked','wells',{login_only:true})
+ it { expect(user.accounts.empty?).to be_falsey }
+ end
+
+ context 'requests a list of options for code based MFA' do
+ Plaid.config do |p|
+ p.customer_id = 'test_id'
+ p.secret = 'test_secret'
+ p.environment_location = 'https://tartan.plaid.com/'
+ end
+ user = Plaid.add_user('connect','plaid_selections', 'plaid_locked','citi',{list: true})
+ it { expect(user.accounts.empty?).to be_falsey }
+ end
+
+ context 'sets a start date for transactions' do
+ Plaid.config do |p|
+ p.customer_id = 'test_id'
+ p.secret = 'test_secret'
+ p.environment_location = 'https://tartan.plaid.com/'
+ end
+ user = Plaid.add_user('connect','plaid_selections', 'plaid_locked','wells',{login_only:true, start_date:'10 days ago'})
+ it { expect(user.accounts.empty?).to be_falsey }
+ end
+
+ context 'sets an end date for transactions' do
+ Plaid.config do |p|
+ p.customer_id = 'test_id'
+ p.secret = 'test_secret'
+ p.environment_location = 'https://tartan.plaid.com/'
+ end
+ user = Plaid.add_user('connect','plaid_selections', 'plaid_locked','wells',{login_only:true, end_date: '10 days ago'})
+ it { expect(user.accounts.empty?).to be_falsey }
+ end
end
# Institution specs
describe '#Institution' do
context 'when a single institution is found' do
@@ -213,9 +283,33 @@
end
########## Plaid instantiated user specs ##########
describe '#User' do
+
+ describe 'user vars' do
+
+ context 'valid user has accounts and accounts contain id attribute' do
+ Plaid.config do |p|
+ p.customer_id = 'test_id'
+ p.secret = 'test_secret'
+ p.environment_location = 'https://tartan.plaid.com/'
+ end
+ user = Plaid.add_user('connect','plaid_test','plaid_good','wells')
+ it { expect(user.accounts.first.id).to be_truthy }
+ end
+
+ context 'valid user has accounts and accounts contain type attribute' do
+ Plaid.config do |p|
+ p.customer_id = 'test_id'
+ p.secret = 'test_secret'
+ p.environment_location = 'https://tartan.plaid.com/'
+ end
+ user = Plaid.add_user('connect','plaid_test','plaid_good','wells')
+ it { expect(user.accounts.first.type).to eq('depository') }
+ end
+ end
+
# MFA specs - after user is instantiated,
describe '#mfa_authentication' do
context 'enters correct credentials for MFA auth and authenticates' do
Plaid.config do |p|
\ No newline at end of file