Sha256: 89a81b2923606e5436edcf68f733ff49569c72220e906f1db9f189ee3559208e

Contents?: true

Size: 829 Bytes

Versions: 6

Compression:

Stored size: 829 Bytes

Contents

require 'spec_helper'

describe Reviewed::Util do
  describe 'build request headers' do
    before(:each) do
      @headers = Reviewed::Util.build_request_headers(extra: 1)
    end

    it 'sets the authorization header' do
      @headers['X-Reviewed-Authorization'].should == Reviewed.api_key
    end

    it 'sets the accept header' do
      @headers['accept'].should == 'json'
    end

    it 'sets additional headers' do
      @headers['extra'].should == 1
    end
  end

  describe 'build query string' do
    it 'includes a single key/value pair' do
      str = Reviewed::Util.build_query_string(name: 'test')
      str.should == 'name=test'
    end

    it 'includes multiple key/value pairs' do
      str = Reviewed::Util.build_query_string(name: 'test', page: 1)
      str.should == 'name=test&page=1'
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
reviewed-0.0.6 spec/util_spec.rb
reviewed-0.0.5 spec/util_spec.rb
reviewed-0.0.4 spec/util_spec.rb
reviewed-0.0.3 spec/util_spec.rb
reviewed-0.0.2 spec/util_spec.rb
reviewed-0.0.1 spec/util_spec.rb