Sha256: f5a68365084794767826ae8493646bce32c3b8b3a3774dc727374b27fb0dc27f

Contents?: true

Size: 1.51 KB

Versions: 3

Compression:

Stored size: 1.51 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Client::Repos::Deployments, '#create_status' do
  let(:user)   { 'nahiluhmot' }
  let(:repo)   { 'github' }
  let(:id)     { 12147 }
  let(:request_path) { "/repos/#{user}/#{repo}/deployments/#{id}/statuses" }
  let(:params) {
    {
      'state' => 'success'
    }
  }

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

  after { reset_authentication_for(subject) }

  context "resouce created" do
    let(:body) { fixture('repos/deployment_status.json') }
    let(:status) { 201 }

    it "should fail to create resource if 'state' input is missing" do
      expect {
        subject.create_status user, repo, id, params.except('state')
      }.to raise_error(Github::Error::RequiredParams)
    end

    it "should create resource successfully" do
      subject.create_status user, repo, id, params
      a_post(request_path).with(:body => params).should have_been_made
    end

    it "should return the resource" do
      status = subject.create_status user, repo, id, params
      status.should be_a Github::ResponseWrapper
    end

    it "should get the deployment information" do
      status = subject.create_status user, repo, id, params
      status.state.should == 'success'
    end
  end

  it_should_behave_like 'request failure' do
    let(:requestable) { subject.create_status user, repo, id, params }
  end

end # create_status

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
github_api-0.12.3 spec/github/client/repos/deployments/create_status_spec.rb
github_api-0.12.2 spec/github/client/repos/deployments/create_status_spec.rb
github_api-0.12.1 spec/github/client/repos/deployments/create_status_spec.rb