Sha256: d59c322ea0ac2012c7fc0d1a951a581a28b8c26fbea391498a701c50310bd296

Contents?: true

Size: 653 Bytes

Versions: 1

Compression:

Stored size: 653 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

RSpec.describe Github::Client::Authorizations, 'two-factor' do
  let(:basic_auth) { 'login:password' }
  let(:host) { "https://#{basic_auth}@api.github.com" }

  it "fails with known OTP error" do
    stub_get("/authorizations/1", host).to_return(
      status: 401,
      headers: {
        content_type: 'application/json',
        'X-GitHub-OTP' => 'required; sms'
      },
      body: {message: "Require two-factor authentication OTP token."}
    )
    expect {
      described_class.new(basic_auth: 'login:password').get(1)
    }.to raise_error(Github::Error::Unauthorized, /Require two-factor/)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
github_api-0.12.3 spec/github/client/authorizations/two_factor_spec.rb