Sha256: e89c8b1da2541f7c80c4563fc0a18507730ebd0f516520411b72c120bfc759e6

Contents?: true

Size: 1.08 KB

Versions: 14

Compression:

Stored size: 1.08 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::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

14 entries across 14 versions & 1 rubygems

Version Path
github_api-0.11.3 spec/github/gists/is_starred_spec.rb
github_api-0.11.2 spec/github/gists/is_starred_spec.rb
github_api-0.11.1 spec/github/gists/is_starred_spec.rb
github_api-0.11.0 spec/github/gists/is_starred_spec.rb
github_api-0.10.2 spec/github/gists/is_starred_spec.rb
github_api-0.10.1 spec/github/gists/is_starred_spec.rb
github_api-0.10.0 spec/github/gists/is_starred_spec.rb
github_api-0.9.7 spec/github/gists/is_starred_spec.rb
github_api-0.9.6 spec/github/gists/is_starred_spec.rb
github_api-0.9.5 spec/github/gists/is_starred_spec.rb
github_api-0.9.4 spec/github/gists/is_starred_spec.rb
github_api-0.9.3 spec/github/gists/is_starred_spec.rb
github_api-0.9.2 spec/github/gists/is_starred_spec.rb
github_api-0.9.1 spec/github/gists/is_starred_spec.rb