Sha256: ed471b087cc1bac54884477e8b2b913c88821c168f62d7cc6b1e60c99f4a4fbb

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Client::Gists, '#unstar' do
  let(:gist_id) { 1 }
  let(:request_path) { "/gists/#{gist_id}/star" }
  let(:body) { '' }
  let(:status) { 204 }

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

  after { reset_authentication_for(subject) }

  context 'when gist is starred' do
    let(:status) { 204 }

    it { expect { subject.starred? }.to raise_error(ArgumentError) }

    it 'should raise error if gist id not present' do
      expect { subject.starred? nil }.to raise_error(ArgumentError)
    end

    it 'should perform request' do
      subject.starred? gist_id
      a_get(request_path).should have_been_made
    end

    it 'should return true if gist is already starred' do
      subject.starred?(gist_id).should be_true
    end
  end

  context 'when gist is not starred' do
    let(:status) { 404 }

    it 'should return false if gist is not starred' do
      subject.starred?(gist_id).should be_false
    end
  end
end # starred?

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
github_api-0.12.3 spec/github/client/gists/is_starred_spec.rb
github_api-0.12.2 spec/github/client/gists/is_starred_spec.rb
github_api-0.12.1 spec/github/client/gists/is_starred_spec.rb
github_api-0.12.0 spec/github/client/gists/is_starred_spec.rb