Sha256: 058454130f000fbe3ed15e6abfca1d2ded9097edeaa1ce398747d5e1b932f213

Contents?: true

Size: 903 Bytes

Versions: 20

Compression:

Stored size: 903 Bytes

Contents

require 'spec_helper'

describe GH do
  it 'allows doing requests right from the GH object' do
    GH['users/rkh']['name'].should be == "Konstantin Haase"
  end

  it 'allows posting to github' do
    stub_request(:post, "https://api.github.com/somewhere").
      with(:body => "{\"foo\":\"bar\"}").to_return(:status => 200, :body => '{"hi": "ho"}', :headers => {})
    response = GH.post "somewhere", "foo" => "bar"
    response['hi'].should be == 'ho'
  end

  describe 'with' do
    it 'returns the GH instance if no block is given' do
      GH.with(:token => "...").should be_a(GH::Wrapper)
    end

    it 'returns the block value if block is given' do
      GH.with(:token => "...") { 42 }.should be == 42
    end

    it 'propagates options' do
      GH.with(:a => :b) do
        GH.with(:b => :c) do
          GH.options.should be == {:a => :b, :b => :c}
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
gh-0.13.0 spec/gh_spec.rb
gh-0.12.4 spec/gh_spec.rb
gh-0.12.3 spec/gh_spec.rb
gh-0.12.2 spec/gh_spec.rb
gh-0.12.1 spec/gh_spec.rb
gh-0.12.0 spec/gh_spec.rb
gh-0.11.3 spec/gh_spec.rb
gh-0.11.2 spec/gh_spec.rb
gh-0.11.1 spec/gh_spec.rb
gh-0.11.0 spec/gh_spec.rb
gh-0.10.3 spec/gh_spec.rb
gh-0.10.2 spec/gh_spec.rb
gh-0.10.1 spec/gh_spec.rb
gh-0.10.0 spec/gh_spec.rb
gh-0.9.2 spec/gh_spec.rb
gh-0.9.1 spec/gh_spec.rb
gh-0.9.0 spec/gh_spec.rb
gh-0.8.0 spec/gh_spec.rb
gh-0.7.3 spec/gh_spec.rb
gh-0.7.1 spec/gh_spec.rb