Sha256: 566fb0cc00c10a5c6fa16f15195f7634deb966bc41c74c9f5065f73e2b3e2974

Contents?: true

Size: 1.03 KB

Versions: 15

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe Restforce::Middleware::Authentication::Password do
  let(:options) do
    { host: 'login.salesforce.com',
      username: 'foo',
      password: 'bar',
      security_token: 'security_token',
      client_id: 'client_id',
      client_secret: 'client_secret',
      adapter: :net_http }
  end

  it_behaves_like 'authentication middleware' do
    let(:success_request) do
      stub_login_request(
        body: "grant_type=password&client_id=client_id&client_secret=client_secret" \
                 "&username=foo&password=barsecurity_token"
      ).to_return(status: 200, body: fixture(:auth_success_response))
    end

    let(:fail_request) do
      stub_login_request(
        body: "grant_type=password&client_id=client_id&client_secret=client_secret" \
                 "&username=foo&password=barsecurity_token"
      ).to_return(status: 400, body: fixture(:auth_error_response))
    end
  end

  describe '.password' do
    subject { middleware.password }
    it      { should eq 'barsecurity_token' }
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
restforce-2.5.4 spec/unit/middleware/authentication/password_spec.rb
restforce-2.5.3 spec/unit/middleware/authentication/password_spec.rb
restforce-2.5.2 spec/unit/middleware/authentication/password_spec.rb
restforce-2.5.1 spec/unit/middleware/authentication/password_spec.rb
logstash-input-salesforce-3.0.0 vendor/jruby/1.9/gems/restforce-2.4.2/spec/unit/middleware/authentication/password_spec.rb
restforce-2.5.0 spec/unit/middleware/authentication/password_spec.rb
restforce-2.4.2 spec/unit/middleware/authentication/password_spec.rb
restforce-2.4.1 spec/unit/middleware/authentication/password_spec.rb
restforce-2.4.0 spec/unit/middleware/authentication/password_spec.rb
restforce-2.3.0 spec/unit/middleware/authentication/password_spec.rb
restforce-2.2.1 spec/unit/middleware/authentication/password_spec.rb
restforce-2.2.0 spec/unit/middleware/authentication/password_spec.rb
restforce-2.1.3 spec/unit/middleware/authentication/password_spec.rb
restforce-2.1.2 spec/unit/middleware/authentication/password_spec.rb
restforce-2.1.1 spec/unit/middleware/authentication/password_spec.rb