Sha256: 59ae75189aed42555c96cca2d50f094dc8935d3b43acc0c5e17756ad9aa97870

Contents?: true

Size: 1.54 KB

Versions: 14

Compression:

Stored size: 1.54 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Repos::Statuses, '#create' do
  let(:user) { 'peter-murach' }
  let(:repo) { 'github' }
  let(:sha) { 'f5f71ce1b7295c31f091be1654618c7ec0cc6b71' }
  let(:request_path) { "/repos/#{user}/#{repo}/statuses/#{sha}" }
  let(:inputs) {
    {
      'state' => 'success'
    }
  }

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

  after { reset_authentication_for(subject) }

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

    it { expect { subject.create user, repo }.to raise_error(ArgumentError) }

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

    it "should create resource successfully" do
      subject.create user, repo, sha, inputs
      a_post(request_path).with(inputs).should have_been_made
    end

    it "should return the resource" do
      status = subject.create user, repo, sha, inputs
      status.should be_a Github::ResponseWrapper
    end

    it "should get the status information" do
      status = subject.create user, repo, sha, inputs
      status.state.should == 'success'
    end
  end

  it_should_behave_like 'request failure' do
    let(:requestable) { subject.create user, repo, sha, inputs }
  end

end # create

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
github_api-0.11.3 spec/github/repos/statuses/create_spec.rb
github_api-0.11.2 spec/github/repos/statuses/create_spec.rb
github_api-0.11.1 spec/github/repos/statuses/create_spec.rb
github_api-0.11.0 spec/github/repos/statuses/create_spec.rb
github_api-0.10.2 spec/github/repos/statuses/create_spec.rb
github_api-0.10.1 spec/github/repos/statuses/create_spec.rb
github_api-0.10.0 spec/github/repos/statuses/create_spec.rb
github_api-0.9.7 spec/github/repos/statuses/create_spec.rb
github_api-0.9.6 spec/github/repos/statuses/create_spec.rb
github_api-0.9.5 spec/github/repos/statuses/create_spec.rb
github_api-0.9.4 spec/github/repos/statuses/create_spec.rb
github_api-0.9.3 spec/github/repos/statuses/create_spec.rb
github_api-0.9.2 spec/github/repos/statuses/create_spec.rb
github_api-0.9.1 spec/github/repos/statuses/create_spec.rb