Sha256: e2fe350dd495df1b9f60572793f45237580dadb33d90afd963994cb6a7f86c4f

Contents?: true

Size: 818 Bytes

Versions: 13

Compression:

Stored size: 818 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(:to_hash) do
        should == {:grant_type => :password, :username => 'username', :password => 'password'}
      end
    end

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

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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rack-oauth2-0.11.0 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-0.10.1 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-0.10.0 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-0.10.0.alpha spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-0.9.5 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-0.9.4 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-0.9.3 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-0.9.2 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-0.9.1 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-0.9.0 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-0.9.0.alpha spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-0.8.7 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-0.8.6 spec/rack/oauth2/client/grant/password_spec.rb