Sha256: 7e3ea172fdb8e99e1e2ffc190606f93ba3a853aba4bc4358dcabdf2bc822a0dd

Contents?: true

Size: 1.13 KB

Versions: 14

Compression:

Stored size: 1.13 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Activity::Watching, '#list' do
  let(:user) { 'peter-murach' }
  let(:repo) { 'github' }
  let(:request_path) { "/user/subscriptions/#{user}/#{repo}" }

  after { reset_authentication_for subject }

  context "with username ane reponame passed" do
    context "this repo is being watched by the user"
      before do
        stub_get(request_path).
          to_return(:body => "[]", :status => 404,
                    :headers => {:user_agent => subject.user_agent})
      end

    it "should return false if resource not found" do
      watching = subject.watching? user, repo
      watching.should be_false
    end

    it "should return true if resoure found" do
        stub_get(request_path).
          to_return(:body => "[]", :status => 200,
            :headers => {:user_agent => subject.user_agent})
      watching = subject.watching? user, repo
      watching.should be_true
    end
  end

  context "without username and reponame passed" do
    it "should fail validation " do
      expect { subject.watching? user, nil }.to raise_error(ArgumentError)
    end
  end
end # watching?

Version data entries

14 entries across 14 versions & 1 rubygems

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