Sha256: a05659b974b5825422810b8bcefcbdad8af803d24af85a1b6cebd2a3b4f5cb87

Contents?: true

Size: 682 Bytes

Versions: 16

Compression:

Stored size: 682 Bytes

Contents

require 'spec_helper'

describe Github::API do

  let(:api) { Github::API.new }

  before(:each) do
    @params = { 'a' => { :b => { 'c' => 1 }, 'd' => [ 'a', { :e => 2 }] } }
  end

  it "should stringify all the keys inside nested hash" do
    actual = api.send(:_normalize_params_keys, @params)
    expected = { 'a' => { 'b'=> { 'c' => 1 }, 'd' => [ 'a', { 'e'=> 2 }] } }
    actual.should == expected
  end

  it "should filter param keys" do
    valid = ['a', 'b', 'e']
    hash = {'a' => 1, 'b' => 3, 'c' => 2, 'd'=> 4, 'e' => 5 }
    actual = api.send(:_filter_params_keys, valid, hash)
    expected = {'a' => 1, 'b' => 3, 'e' => 5 }
    actual.should == expected
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
github_api-0.4.0 spec/github/api_spec.rb
github_api-0.3.9 spec/github/api_spec.rb
github_api-0.3.8 spec/github/api_spec.rb
github_api-0.3.7 spec/github/api_spec.rb
github_api-0.3.6 spec/github/api_spec.rb
github_api-0.3.4 spec/github/api_spec.rb
github_api-0.3.3 spec/github/api_spec.rb
github_api-0.3.2 spec/github/api_spec.rb
github_api-0.3.1 spec/github/api_spec.rb
github_api-0.3.0 spec/github/api_spec.rb
github_api-0.2.2 spec/github/api_spec.rb
github_api-0.2.1 spec/github/api_spec.rb
github_api-0.2.0 spec/github/api_spec.rb
github_api-0.1.2 spec/github/api_spec.rb
github_api-0.1.1 spec/github/api_spec.rb
github_api-0.1.0 spec/github/api_spec.rb