Sha256: b36eb6c1313f7797dd2ca5b135b222ec873e08ee04ee6896cbb4d782dbbf704c

Contents?: true

Size: 793 Bytes

Versions: 48

Compression:

Stored size: 793 Bytes

Contents

require 'spec_helper.rb'

describe Rack::OAuth2::Client::Grant::Password do
  let(:grant) { Rack::OAuth2::Client::Grant::Password }

  context 'when username is given' do
    let :attributes do
      {username: 'username'}
    end

    context 'when password is given' do
      let :attributes do
        {username: 'username', password: 'password'}
      end
      subject { grant.new attributes }
      its(:as_json) do
        should == {grant_type: :password, username: 'username', password: 'password'}
      end
    end

    context 'otherwise' do
      it do
        expect { grant.new attributes }.to raise_error AttrRequired::AttrMissing
      end
    end
  end

  context 'otherwise' do
    it do
      expect { grant.new }.to raise_error AttrRequired::AttrMissing
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
rack-oauth2-2.2.1 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-2.2.0 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-2.1.0 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-2.0.1 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-2.0.0 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-2.0.0.rc3 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-2.0.0.rc2 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-2.0.0.rc1 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.21.3 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.21.2 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.21.1 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.21.0 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.20.0 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.19.0 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.18.0 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.17.0 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.16.0 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.15.0 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.14.0 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.13.0 spec/rack/oauth2/client/grant/password_spec.rb