Sha256: 26ade07ee2442a9737c574f9d3ad591f0664f5803a213ab68a773395fc8192d4

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Client::Activity::Starring, '#unstar' do
  let(:user) { 'peter-murach' }
  let(:repo) { 'github' }
  let(:request_path) { "/user/starred/#{user}/#{repo}" }

  after { reset_authentication_for subject }

  context "user authenticated" do
    context "with correct information" do
      before do
        subject.oauth_token = OAUTH_TOKEN
        stub_delete("/user/starred/#{user}/#{repo}").
          with(:query => {:access_token => OAUTH_TOKEN}).
          to_return(:body => "", :status => 204, :headers => {})
      end

      it "should successfully unstar a repo" do
        subject.unstar user, repo
        a_delete(request_path).with(:query => {:access_token => OAUTH_TOKEN}).
          should have_been_made
      end
    end
  end

  context "user unauthenticated" do
    it "should fail" do
      stub_delete(request_path).to_return(:body => "", :status => 401, :headers => {})
      expect {
        subject.unstar user, repo
      }.to raise_error(Github::Error::Unauthorized)
    end
  end
end # unstar

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
github_api-0.12.3 spec/github/client/activity/starring/unstar_spec.rb
github_api-0.12.2 spec/github/client/activity/starring/unstar_spec.rb
github_api-0.12.1 spec/github/client/activity/starring/unstar_spec.rb
github_api-0.12.0 spec/github/client/activity/starring/unstar_spec.rb