Sha256: 85ec83720f8d2d36b7df7f507a5a24ea567e420e26330973251948078f81f9dd

Contents?: true

Size: 1.44 KB

Versions: 4

Compression:

Stored size: 1.44 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Client::Orgs::Teams, '#edit' do
  let(:team)   { 'github' }
  let(:request_path) { "/teams/#{team}" }

  let(:inputs) {
    { :name => 'new team',
      :permissions => 'push',
    }
  }

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

  after { reset_authentication_for(subject) }

  context "resouce edited" do
    let(:body) { fixture('orgs/team.json') }
    let(:status) { 200 }

    it "should fail to create resource if 'team name' param is missing" do
      expect { subject.edit }.to raise_error(ArgumentError)
    end

    it "should failt to create resource if 'name' input is missing" do
      expect {
        subject.edit team, inputs.except(:name)
      }.to raise_error(Github::Error::RequiredParams)
    end

    it "should create resource successfully" do
      subject.edit team, inputs
      a_patch(request_path).with(inputs).should have_been_made
    end

    it "should return the resource" do
      edited_team = subject.edit team, inputs
      edited_team.should be_a Github::ResponseWrapper
    end

    it "should get the team information" do
      edited_team = subject.edit team, inputs
      edited_team.name.should == 'Owners'
    end
  end

  it_should_behave_like 'request failure' do
    let(:requestable) { subject.edit team, inputs }
  end

end # edit

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
github_api-0.12.3 spec/github/client/orgs/teams/edit_spec.rb
github_api-0.12.2 spec/github/client/orgs/teams/edit_spec.rb
github_api-0.12.1 spec/github/client/orgs/teams/edit_spec.rb
github_api-0.12.0 spec/github/client/orgs/teams/edit_spec.rb