Sha256: 334d310567b6cf3708764449c8a7651e78159fcd9fec9ba79e7b052868438a30

Contents?: true

Size: 1020 Bytes

Versions: 1

Compression:

Stored size: 1020 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Gists, '#star' do
  let(:gist_id) { 1 }
  let(:request_path) { "/gists/#{gist_id}/fork" }
  let(:body) { fixture('gists/gist.json') }
  let(:status) { 201 }

  before {
    stub_post(request_path).to_return(:body => body, :status => status,
      :headers => {:content_type => "application/json; charset=utf-8"})
  }

  after { reset_authentication_for(subject) }

  it "should fail to fork gist without gist id" do
    expect { subject.fork(nil) }.to raise_error(ArgumentError)
  end

  it "should fork resource successfully" do
    subject.fork gist_id
    a_post(request_path).should have_been_made
  end

  it "should return the resource" do
    gist = subject.fork gist_id
    gist.should be_a Github::ResponseWrapper
  end

  it "should get the gist information" do
    gist = subject.fork gist_id
    gist.user.login.should == 'octocat'
  end

  it_should_behave_like 'request failure' do
    let(:requestable) { subject.fork gist_id }
  end

end # fork

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
github_api-0.9.0 spec/github/gists/fork_spec.rb