Sha256: 99387cb9d3fc54731692c94156a5a94828e787e07e14c315df2521a27be372da

Contents?: true

Size: 810 Bytes

Versions: 17

Compression:

Stored size: 810 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

17 entries across 17 versions & 2 rubygems

Version Path
rack-oauth2-1.1.1 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.1.0 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.0.10 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.0.9 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.0.8 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-revibe-1.0.7 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.0.7 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.0.6 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.0.5 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.0.4 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.0.3 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.0.2 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.0.1 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-1.0.0 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-0.14.9 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-0.14.8 spec/rack/oauth2/client/grant/password_spec.rb
rack-oauth2-0.14.7 spec/rack/oauth2/client/grant/password_spec.rb