Sha256: 1383e7b1406a9cae3c30c15b347b0d3fa5080eaf5811f78a155a062764bc09c4

Contents?: true

Size: 1.11 KB

Versions: 14

Compression:

Stored size: 1.11 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Orgs::Teams, '#add_member' do
  let(:team_id) { 1 }
  let(:user) { 'peter-murach' }
  let(:request_path) { "/teams/#{team_id}/members/#{user}" }

  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 { expect { subject.add_member }.to raise_error(ArgumentError)}

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

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

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

  it_should_behave_like 'request failure' do
    let(:requestable) { subject.add_member team_id, user }
  end
end # add_member

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
github_api-0.11.3 spec/github/orgs/teams/add_member_spec.rb
github_api-0.11.2 spec/github/orgs/teams/add_member_spec.rb
github_api-0.11.1 spec/github/orgs/teams/add_member_spec.rb
github_api-0.11.0 spec/github/orgs/teams/add_member_spec.rb
github_api-0.10.2 spec/github/orgs/teams/add_member_spec.rb
github_api-0.10.1 spec/github/orgs/teams/add_member_spec.rb
github_api-0.10.0 spec/github/orgs/teams/add_member_spec.rb
github_api-0.9.7 spec/github/orgs/teams/add_member_spec.rb
github_api-0.9.6 spec/github/orgs/teams/add_member_spec.rb
github_api-0.9.5 spec/github/orgs/teams/add_member_spec.rb
github_api-0.9.4 spec/github/orgs/teams/add_member_spec.rb
github_api-0.9.3 spec/github/orgs/teams/add_member_spec.rb
github_api-0.9.2 spec/github/orgs/teams/add_member_spec.rb
github_api-0.9.1 spec/github/orgs/teams/add_member_spec.rb