Sha256: 785f9f9841704b30ad3b229a24ac4cdaf5d6334a885da5ffa90840c01d14a5c8

Contents?: true

Size: 1.59 KB

Versions: 10

Compression:

Stored size: 1.59 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 Hashie::Mash
    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

10 entries across 10 versions & 1 rubygems

Version Path
github_api-0.8.11 spec/github/repos/merging/merge_spec.rb
github_api-0.8.10 spec/github/repos/merging/merge_spec.rb
github_api-0.8.9 spec/github/repos/merging/merge_spec.rb
github_api-0.8.8 spec/github/repos/merging/merge_spec.rb
github_api-0.8.7 spec/github/repos/merging/merge_spec.rb
github_api-0.8.6 spec/github/repos/merging/merge_spec.rb
github_api-0.8.5 spec/github/repos/merging/merge_spec.rb
github_api-0.8.4 spec/github/repos/merging/merge_spec.rb
github_api-0.8.3 spec/github/repos/merging/merge_spec.rb
github_api-0.8.2 spec/github/repos/merging/merge_spec.rb