Sha256: 03a96f4105b11421da8f4176886fb637ec68bf4383eafbf930cfcdfad83a499b

Contents?: true

Size: 1.07 KB

Versions: 18

Compression:

Stored size: 1.07 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Orgs::Teams, '#team_repo?' do
  let(:team_id) { 1 }
  let(:user) { 'peter-murach' }
  let(:repo) { 'github' }
  let(:request_path) { "/teams/#{team_id}/repos/#{user}/#{repo}" }
  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 repo is managed by this team' do
    let(:status) { 204 }

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

    it "should return true if resoure found" do
      team_managed = subject.team_repo? team_id, user, repo
      team_managed.should be_true
    end
  end

  context 'when repo is not managed by this team' do
    let(:status) { 404 }

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

end # team_repo?

Version data entries

18 entries across 18 versions & 1 rubygems

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