Sha256: 381bf30b3b53fa09e9b711731d98fc520a06f7af4c03a71766009e27e27fd5fa

Contents?: true

Size: 1020 Bytes

Versions: 27

Compression:

Stored size: 1020 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Activity::Starring, '#star' 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_put(request_path).with(:query => {:access_token => OAUTH_TOKEN}).
          to_return(:body => "", :status => 204, :headers => {})
      end

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

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

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
github_api-0.11.3 spec/github/activity/starring/star_spec.rb
github_api-0.11.2 spec/github/activity/starring/star_spec.rb
github_api-0.11.1 spec/github/activity/starring/star_spec.rb
github_api-0.11.0 spec/github/activity/starring/star_spec.rb
github_api-0.10.2 spec/github/activity/starring/star_spec.rb
github_api-0.10.1 spec/github/activity/starring/star_spec.rb
github_api-0.10.0 spec/github/activity/starring/star_spec.rb
github_api-0.9.7 spec/github/activity/starring/star_spec.rb
github_api-0.9.6 spec/github/activity/starring/star_spec.rb
github_api-0.9.5 spec/github/activity/starring/star_spec.rb
github_api-0.9.4 spec/github/activity/starring/star_spec.rb
github_api-0.9.3 spec/github/activity/starring/star_spec.rb
github_api-0.9.2 spec/github/activity/starring/star_spec.rb
github_api-0.9.1 spec/github/activity/starring/star_spec.rb
github_api-0.9.0 spec/github/activity/starring/star_spec.rb
github_api-0.8.11 spec/github/activity/starring/star_spec.rb
github_api-0.8.10 spec/github/activity/starring/star_spec.rb
github_api-0.8.9 spec/github/activity/starring/star_spec.rb
github_api-0.8.8 spec/github/activity/starring/star_spec.rb
github_api-0.8.7 spec/github/activity/starring/star_spec.rb