Sha256: 9a1f2e22e3e88f56d65fc9a7f5274bfcdee57143db8c26e91e99375762278101

Contents?: true

Size: 1.03 KB

Versions: 27

Compression:

Stored size: 1.03 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Activity::Watching, '#unwatch' do
  let(:user) { 'peter-murach' }
  let(:repo) { 'github' }
  let(:request_path) { "/user/subscriptions/#{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(request_path).with(:query => {:access_token => OAUTH_TOKEN}).
          to_return(:body => "", :status => 204, :headers => {})
      end

      it "should successfully watch a repo" do
        subject.unwatch 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.unwatch user, repo
      }.to raise_error(Github::Error::Unauthorized)
    end
  end
end # unwatch

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
github_api-0.8.6 spec/github/activity/watching/unwatch_spec.rb
github_api-0.8.5 spec/github/activity/watching/unwatch_spec.rb
github_api-0.8.4 spec/github/activity/watching/unwatch_spec.rb
github_api-0.8.3 spec/github/activity/watching/unwatch_spec.rb
github_api-0.8.2 spec/github/activity/watching/unwatch_spec.rb
github_api-0.8.1 spec/github/activity/watching/unwatch_spec.rb
github_api-0.8.0 spec/github/activity/watching/unwatch_spec.rb