Sha256: a91d99a199d40d76ed746e4a8a7310c7e643747fb5e6476c6100d52ce0044433

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

require "spec_helper"

require "adyen-admin/client"

describe Adyen::Admin::Client, :vcr  do
  let(:login) { Adyen::Admin.login($adyen[:account], $adyen[:user], $adyen[:password]) }

  before do
    Adyen::Admin.client.cookie_jar.clear!
  end

  describe "#login" do
    it 'passes with correct username + password' do
      expect do
        login
      end.to_not raise_error
    end

    it 'fails on wrong username + password' do
      expect do
        Adyen::Admin.login("Tobi", "fake", "wrong")
      end
    end
  end

  describe "#get" do
    it 'raises authenticated error when not logged in' do
      expect do
        Adyen::Admin.get(Adyen::Admin::Skin::SKINS)
      end.to raise_error Adyen::Admin::AuthenticationError
    end

    it 'sets authenticated to false on error' do
      Adyen::Admin.instance_variable_set(:@authenticated, true)

      expect do
        Adyen::Admin.get(Adyen::Admin::Skin::SKINS) rescue nil
      end.to change { Adyen::Admin.authenticated? }.from(true).to(false)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
adyen-admin-0.0.18 spec/adyen-admin/client_spec.rb
adyen-admin-0.0.17 spec/adyen-admin/client_spec.rb