Sha256: 0fbc9df5dc7cf33c76dd363debf9ce889a8ce9a063e0c35e5dffb1b4a98e6b39

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

require "spec_helper"

describe "Application authorization flow" do
  # http://api.yandex.ru/money/doc/dg/reference/request-access-token.xml
  it "should properly initialize without client_secret" do
    VCR.use_cassette "init without client secret" do
      url = YandexMoney::Wallet.build_obtain_token_url(
        CLIENT_ID,
        REDIRECT_URI,
        "account-info operation-history"
      )
      expect(url).to start_with("https://money.yandex.ru/select-wallet.xml?requestid=")
    end
  end

  # http://api.yandex.ru/money/doc/dg/reference/request-access-token.xml
  it "should get token from code" do
    VCR.use_cassette "get token from authorization code" do
      expect(
        YandexMoney::Wallet.get_access_token(
          CLIENT_ID,
          "SOME CODE",
          REDIRECT_URI
        )
      ).to be nil
    end
  end

  it "could be initialized with token" do
    VCR.use_cassette "initialize with token" do
      api = YandexMoney::Wallet.new(ACCESS_TOKEN)
      expect(api.account_info.account).to eq WALLET_NUMBER
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
yandex-money-client-1.0.6 spec/auth_spec.rb
yandex-money-sdk-1.0.5 spec/auth_spec.rb