Sha256: 64c5116813728ddc62e9c79e5abc301ecf720a8484a58ca3cdfbf9c31b43e285

Contents?: true

Size: 772 Bytes

Versions: 9

Compression:

Stored size: 772 Bytes

Contents

require 'spec_helper'
require 'rack/test'

describe BitBucket::Request::OAuth do
  include Rack::Test::Methods


  let(:app) { ->(env) { [200, env, "app"] } }

  let (:middleware) { BitBucket::Request::OAuth.new(app) }

  let(:request) { Rack::MockRequest.new(middleware) }

  it "add url key to env hash with URI value" do
    query_string = "key1=val1&key2=val2"
    code, env = middleware.call Rack::MockRequest.env_for("/?#{query_string}", {method: :post})
    expect(code).to eq 200
    expect(env[:url].query).to eq query_string
  end

  it "creates a empty hash if query of URI is empty" do
    code, env = middleware.call Rack::MockRequest.env_for("/", {method: :get})
    expect(code).to eq 200
    expect(middleware.query_params(env[:url])).to eq({})
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
zz_bitbucket_rest_api-0.1.11 spec/bitbucket_rest_api/request/oauth_spec.rb
zz_bitbucket_rest_api-0.1.10 spec/bitbucket_rest_api/request/oauth_spec.rb
zz_bitbucket_rest_api-0.1.9 spec/bitbucket_rest_api/request/oauth_spec.rb
zz_bitbucket_rest_api-0.1.8 spec/bitbucket_rest_api/request/oauth_spec.rb
bitbucket_rest_api2-0.9.5 spec/bitbucket_rest_api/request/oauth_spec.rb
bitbucket_rest_api2-0.9.1 spec/bitbucket_rest_api/request/oauth_spec.rb
bitbucket_rest_api2-0.2.2 spec/bitbucket_rest_api/request/oauth_spec.rb
bitbucket_rest_api2-0.2.1 spec/bitbucket_rest_api/request/oauth_spec.rb
bitbucket_rest_api2-0.2.0 spec/bitbucket_rest_api/request/oauth_spec.rb