Sha256: bd518a0d4e9173dc9d95cb6f0ab25e30f97fedfdc6a0f1b87422fe4e6c6096d7

Contents?: true

Size: 992 Bytes

Versions: 12

Compression:

Stored size: 992 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Repos::Collaborators, '#add' do
  let(:user) { 'peter-murach' }
  let(:repo) { 'github' }
  let(:collaborator) { 'octocat' }
  let(:request_path) { "/repos/#{user}/#{repo}/collaborators/#{collaborator}" }

  before {
    stub_put(request_path).
      to_return(:body => body, :status => status,
        :headers => {:content_type => "application/json; charset=utf-8"})
  }

  after { reset_authentication_for(subject) }

  context "resouce added" do
    let(:body) { '' }
    let(:status) { 204 }

    it "should fail to add resource if 'collaborator' input is missing" do
      expect { subject.add user, repo, nil }.to raise_error(ArgumentError)
    end

    it "should add resource successfully" do
      subject.add user, repo, collaborator
      a_put(request_path).should have_been_made
    end
  end

  it_should_behave_like 'request failure' do
    let(:requestable) { subject.add user, repo, collaborator }
  end

end # add

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
github_api-0.9.0 spec/github/repos/collaborators/add_spec.rb
github_api-0.8.11 spec/github/repos/collaborators/add_spec.rb
github_api-0.8.10 spec/github/repos/collaborators/add_spec.rb
github_api-0.8.9 spec/github/repos/collaborators/add_spec.rb
github_api-0.8.8 spec/github/repos/collaborators/add_spec.rb
github_api-0.8.7 spec/github/repos/collaborators/add_spec.rb
github_api-0.8.6 spec/github/repos/collaborators/add_spec.rb
github_api-0.8.5 spec/github/repos/collaborators/add_spec.rb
github_api-0.8.4 spec/github/repos/collaborators/add_spec.rb
github_api-0.8.3 spec/github/repos/collaborators/add_spec.rb
github_api-0.8.2 spec/github/repos/collaborators/add_spec.rb
github_api-0.8.1 spec/github/repos/collaborators/add_spec.rb