spec/plaid_spec.rb in plaid-1.1.2 vs spec/plaid_spec.rb in plaid-1.2.0

- old
+ new

@@ -65,10 +65,20 @@ end user = Plaid.add_user('auth','plaid_test','plaid_good','wells') it { expect(user.accounts[0].numbers.nil?).to be_falsey } end + context 'has correct credentials for single factor auth, authenticates to the info level of api access' 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('info','plaid_test','plaid_good','wells') + it { expect(user.info).to be_truthy } + end + context 'has correct username, but incorrect password for single factor auth under auth level of api access' do Plaid.config do |p| p.customer_id = 'test_id' p.secret = 'test_secret' p.environment_location = 'https://tartan.plaid.com/' @@ -101,10 +111,28 @@ p.environment_location = 'https://tartan.plaid.com/' end it { expect{Plaid.add_user('connect','plaid_bad','plaid_bad','wells')}.to raise_error } end + context 'has correct username, but incorrect password for single factor auth under info level of api access' do + Plaid.config do |p| + p.customer_id = 'test_id' + p.secret = 'test_secret' + p.environment_location = 'https://tartan.plaid.com/' + end + it { expect{Plaid.add_user('info','plaid_test','plaid_bad','wells')}.to raise_error } + end + + context 'has incorrect username under info level of api access' do + Plaid.config do |p| + p.customer_id = 'test_id' + p.secret = 'test_secret' + p.environment_location = 'https://tartan.plaid.com/' + end + it { expect{Plaid.add_user('info','plaid_bad','plaid_bad','wells')}.to raise_error } + end + context 'enters pin for extra parameter authentication required by certain institutions' do Plaid.config do |p| p.customer_id = 'test_id' p.secret = 'test_secret' p.environment_location = 'https://tartan.plaid.com/' @@ -373,27 +401,65 @@ context 'does not have access to auth' do it{ expect(auth_user.permissions.include? 'connect' ).to be false } end end + # Get info specs + describe '#get_info' do + Plaid.config do |p| + p.customer_id = 'test_id' + p.secret = 'test_secret' + p.environment_location = 'https://tartan.plaid.com/' + end + info_user = Plaid.add_user('info','plaid_test','plaid_good','wells') + auth_user = Plaid.add_user('auth','plaid_test','plaid_good','wells') + + context 'has access and returns user info' do + it { expect(info_user.permissions[0]).to eq('info') } + end + + context 'does not have access to info' do + it{ expect(auth_user.permissions.include? 'info' ).to be false } + end + end + +=begin + describe '#update_info' do + info_user = Plaid.add_user('info','plaid_test','plaid_good','wells') + + context 'updates information correctly' do + it { expect { info_user.update_info('info','plaid_test','plaid_new','wells') }.to be_truthy } + end + end +=end + + describe '#delete_user' do + Plaid.config do |p| + p.customer_id = 'test_id' + p.secret = 'test_secret' + p.environment_location = 'https://tartan.plaid.com/' + end + info_user = Plaid.add_user('info','plaid_test','plaid_good','wells') + info_user.delete_user + + context 'updates information correctly' do + it { expect { info_user.get_info }.to raise_error } + end + end + # Upgrade specs - either pass or fails =begin TODO: Write upgrade methods to pass without paying describe '#upgrade' do auth_user = Plaid.add_user('auth','plaid_test','plaid_good','wells') connect_user = Plaid.add_user('connect','plaid_test','plaid_good','wells') context 'auth upgrade is successful' do - connect_user.upgrade('auth') + connect_user.upgrade it { expect(connect_user.get_auth).to be_truthy } end context 'connect upgrade is successful' do - auth_user.upgrade('connect') - it { expect(auth_user.get_connect).to be_truthy } - end - - context 'connect upgrade is successful' do - auth_user.upgrade('info') + auth_user.upgrade it { expect(auth_user.get_connect).to be_truthy } end end =end \ No newline at end of file