Sha256: 5f71dbe428c90d327b9f20a2861523fcc74e9682d4b62d256e39d649a77b7264

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

# encoding: utf-8

require 'spec_helper'

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

  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 'when user is a member' do
    let(:status) { 204 }

    it "should fail validation " do
      expect { subject.team_member?(nil, nil) }.to raise_error(ArgumentError)
    end

    it "should return true if resoure found" do
      team_membership = subject.team_member? team_id, user
      team_membership.should be_true
    end
  end

  context 'when user is not a member' do
    let(:status) { 404 }

    it "should return false if resource not found" do
      team_membership = subject.team_member? team_id, user
      team_membership.should be_false
    end
  end

end # team_member?

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
github_api-0.9.0 spec/github/orgs/teams/team_member_spec.rb
github_api-0.8.11 spec/github/orgs/teams/team_member_spec.rb
github_api-0.8.10 spec/github/orgs/teams/team_member_spec.rb
github_api-0.8.9 spec/github/orgs/teams/team_member_spec.rb