Sha256: 84f1f685ce29a1565d495413547a5b64cf6bc96a22f190281ef8872c83a51180

Contents?: true

Size: 1.09 KB

Versions: 9

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

describe Restforce::Middleware::Authentication::Token do
  let(:app)        { double('app')            }
  let(:env)        { { }  }
  let(:middleware) { described_class.new app, nil, options }

  let(:options) do
    { host: 'login.salesforce.com',
      refresh_token: 'refresh_token',
      client_id: 'client_id',
      client_secret: 'client_secret' }
  end

  it_behaves_like 'authentication middleware' do
    let(:success_request) do
      stub_request(:post, "https://login.salesforce.com/services/oauth2/token").
        with(:body => "grant_type=refresh_token&refresh_token=refresh_token&" \
        "client_id=client_id&client_secret=client_secret").
        to_return(:status => 200, :body => fixture(:auth_success_response))
    end

    let(:fail_request) do
      stub_request(:post, "https://login.salesforce.com/services/oauth2/token").
        with(:body => "grant_type=refresh_token&refresh_token=refresh_token&" \
        "client_id=client_id&client_secret=client_secret").
        to_return(:status => 400, :body => fixture(:refresh_error_response))
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
restforce-0.1.3 spec/lib/middleware/authentication/token_spec.rb
restforce-0.1.2 spec/lib/middleware/authentication/token_spec.rb
restforce-0.1.1 spec/lib/middleware/authentication/token_spec.rb
restforce-0.1.0 spec/lib/middleware/authentication/token_spec.rb
restforce-0.0.8 spec/lib/middleware/authentication/token_spec.rb
restforce-0.0.7 spec/lib/middleware/authentication/token_spec.rb
restforce-0.0.6 spec/lib/middleware/authentication/token_spec.rb
restforce-0.0.5 spec/lib/middleware/authentication/token_spec.rb
restforce-0.0.4 spec/lib/middleware/authentication/token_spec.rb