spec/plaid_spec.rb in plaid-1.6.2 vs spec/plaid_spec.rb in plaid-1.7.0

- old
+ new

@@ -26,17 +26,16 @@ it { expect(user.accounts).not_to be_empty } end context 'when account is locked' do let(:password) { 'plaid_locked' } - it "raises a locked error" do - expect { user }.to raise_error { |error| - expect(error).to be_a(Plaid::RequestFailed) + + it 'raises a locked error' do + expect { user }.to raise_error(Plaid::RequestFailed) { |error| expect(error.code).to eq(1205) } end - end context 'with connection options' do context 'when requests pending transactions from an institution' do let(:options) { { pending: true } } @@ -88,44 +87,44 @@ context 'at "auth" level api access' do let(:api_level) { 'auth' } context 'using incorrect password' do let(:password) { 'plaid_bad' } - it { expect { user }.to raise_error } + it { expect { user }.to raise_error(Plaid::RequestFailed, 'invalid credentials') } end context 'using incorrect username' do let(:username) { 'plaid_bad' } - it { expect { user }.to raise_error } + it { expect { user }.to raise_error(Plaid::RequestFailed, 'invalid credentials') } end end context 'at "connect" level api access' do let(:api_level) { 'connect' } context 'using incorrect password' do let(:password) { 'plaid_bad' } - it { expect { user }.to raise_error } + it { expect { user }.to raise_error(Plaid::RequestFailed, 'invalid credentials') } end context 'using incorrect username' do let(:username) { 'plaid_bad' } - it { expect { user }.to raise_error } + it { expect { user }.to raise_error(Plaid::RequestFailed, 'invalid credentials') } end end context 'at "info" level api access' do let(:api_level) { 'info' } context 'using incorrect password' do let(:password) { 'plaid_bad' } - it { expect { user }.to raise_error } + it { expect { user }.to raise_error(Plaid::RequestFailed, 'invalid credentials') } end context 'using incorrect username' do let(:username) { 'plaid_bad' } - it { expect { user }.to raise_error } + it { expect { user }.to raise_error(Plaid::RequestFailed, 'invalid credentials') } end end end context 'when institution requires PIN' do @@ -139,10 +138,10 @@ it { expect(user.api_res).to eq 'Requires further authentication' } end context 'using incorrect PIN' do let(:pin) { '0000' } - it { expect { user }.to raise_error } + it { expect { user }.to raise_error(Plaid::RequestFailed, 'invalid pin') } end end context 'when institution requires MFA' do let(:api_level) { 'connect' }