Sha256: 17fc5067265c22c0361bf9af938e9da44a5bdd2941a78739ea38b0de4362f7dd

Contents?: true

Size: 1.17 KB

Versions: 14

Compression:

Stored size: 1.17 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::PullRequests, '#merge' do
  let(:user)   { 'peter-murach' }
  let(:repo)   { 'github' }
  let(:number) { 1347 }
  let(:request_path) { "/repos/#{user}/#{repo}/pulls/#{number}/merge" }

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

  after { reset_authentication_for(subject) }

  context 'successful' do
    let(:body) { fixture('pull_requests/merge_success.json') }
    let(:status) { 200 }

    it { expect { subject.merge }.to raise_error(ArgumentError) }

    it 'performs request' do
      subject.merge user, repo, number
      a_put(request_path).should have_been_made
    end

    it 'response contains merge success flag' do
      response = subject.merge(user, repo, number)
      response.merged.should be_true
    end
  end

  context 'cannot be performed' do
    let(:body) { fixture('pull_requests/merge_failure.json') }
    let(:status) { 200 }

    it 'response contains merge failure flag' do
      response = subject.merge(user, repo, number)
      response.merged.should be_false
    end
  end
end # merge

Version data entries

14 entries across 14 versions & 1 rubygems

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