Sha256: c5edd9ecd49d4341d721026b1da6c3f047265128180accdaa5f4ba352316d257

Contents?: true

Size: 1.23 KB

Versions: 24

Compression:

Stored size: 1.23 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Issues::Assignees, '#check' do
  let(:user) { 'peter-murach' }
  let(:repo) { 'github' }
  let(:assignee) { 'octocat' }
  let(:request_path) { "/repos/#{user}/#{repo}/assignees/#{assignee}" }

  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 "resource found " do
    let(:body) { '[]' }
    let(:status) { 204 }

    it "should fail to get resource without collaborator name" do
      expect { subject.check user, repo, nil }.to raise_error(ArgumentError)
    end

    it "should get the resource" do
      subject.check user, repo, assignee
      a_get(request_path).should have_been_made
    end

    it "should find assignee" do
      subject.should_receive(:check).with(user, repo, assignee) { true }
      subject.check user, repo, assignee
    end
  end

  context "resource not found" do
    let(:body) { '[]' }
    let(:status) { 404 }

    it "should fail to retrieve resource" do
      subject.should_receive(:check).with(user, repo, assignee) { false }
      subject.check user, repo, assignee
    end
  end
end # check

Version data entries

24 entries across 24 versions & 1 rubygems

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