Sha256: 1ce3cb899e135fc6f7059710ba2b87368f8f2602e834b69495ebdc574822c45a

Contents?: true

Size: 730 Bytes

Versions: 2

Compression:

Stored size: 730 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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gh-0.6.1 spec/gh_spec.rb
gh-0.6.0 spec/gh_spec.rb