Sha256: 823ade34957c8152be6827ce7864e251c0d4e67a92adc0d7e89b97e3d94d4784

Contents?: true

Size: 947 Bytes

Versions: 1

Compression:

Stored size: 947 Bytes

Contents

require "spec_helper"

require "adyen-admin/client"

describe Adyen::Admin::Client, :vcr  do
  let(:login) { Adyen::Admin.login("SoundCloud", "skinadmin", "12312311") }

  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
      expect do
        Adyen::Admin.get(Adyen::Admin::Skin::SKINS) rescue nil
      end.to change { Adyen::Admin.authenticated? }.from(nil).to(false)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
adyen-admin-0.0.11 spec/adyen-admin/client_spec.rb