Sha256: 3e513ac8e8c4e4dd2d77c979d8f777f607b2fcb347f23eb5483921c80d062c62

Contents?: true

Size: 830 Bytes

Versions: 4

Compression:

Stored size: 830 Bytes

Contents

require File.expand_path('../../../spec_helper', __FILE__)

describe OAuth2::Grant::Password do

  before :all do
    @host           = 'example.com'
    @client_id      = 's6BhdRkqt3'
    @client_secret  = 'SplxlOBeZQQYbYS6WxSbIA'
    @client = OAuth2::Client.new(@host, @client_id, @client_secret)
  end

  subject do
    OAuth2::Grant::Password.new(@client)
  end

  describe "#grant_type" do
    it "returns grant type" do
      expect(subject.grant_type).to eq 'password'
    end
  end

  describe "#get_token" do
    it "gets access token" do
      subject.should_receive(:make_request).with(:post, "/oauth2/token", {
        :params => {:grant_type=>"password", :username=>"benutzername", :password=>"passwort"},
        :authenticate=>:headers
      })
      subject.get_token('benutzername', 'passwort')
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
oauth2-client-1.1.3 spec/oauth2/grant/password_spec.rb
oauth2-client-1.1.2 spec/oauth2/grant/password_spec.rb
oauth2-client-1.1.1 spec/oauth2/grant/password_spec.rb
oauth2-client-1.1.0 spec/oauth2/grant/password_spec.rb