Sha256: 5954a544b4c5e3fdc96131e647b7f06bdf25d8a22d9ce51db374c5d8915f889d
Contents?: true
Size: 1.26 KB
Versions: 9
Compression:
Stored size: 1.26 KB
Contents
require 'spec_helper' describe Restforce::Middleware::Authentication::Password do let(:app) { double('app') } let(:env) { { } } let(:middleware) { described_class.new app, nil, options } let(:options) do { host: 'login.salesforce.com', username: 'foo', password: 'bar', security_token: 'security_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=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_request(:post, "https://login.salesforce.com/services/oauth2/token"). with(: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
9 entries across 9 versions & 1 rubygems