Sha256: 89740ae6bea9799dfb48622f1bd453489f4c7af9a01d716fa5196bcd6823e8b4

Contents?: true

Size: 1.6 KB

Versions: 15

Compression:

Stored size: 1.6 KB

Contents

require 'spec_helper'

describe Github::Repos::Merging, '#merge' do
  let(:user) { 'peter-murach' }
  let(:repo) { 'github' }
  let(:request_path) { "/repos/#{user}/#{repo}/merges" }
  let(:inputs) do
    {
      "base" => "master",
      "head" => "cool_feature",
      "commit_message" => "Shipped cool_feature!"
    }
  end

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

  after { reset_authentication_for(subject) }

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

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

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

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

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

    it "should get the commit comment information" do
      merge = subject.merge user, repo, inputs
      merge.commit.author.login.should == 'octocat'
    end
  end

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

end # merge

Version data entries

15 entries across 15 versions & 1 rubygems

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