Sha256: cf035a153cd3389cc1bc99855f2bf59624dc40f24b9d11810facb5b0570e8452

Contents?: true

Size: 1.72 KB

Versions: 1

Compression:

Stored size: 1.72 KB

Contents

# -*- encoding: utf-8 -*-
require 'helper'

describe Octokit::Client::Pulls do

  before do
    @client = Octokit::Client.new(:login => 'sferik')
  end

  describe ".create_pull_request" do

    it "should create a pull request" do
      stub_post("https://github.com/api/v2/json/pulls/sferik/rails_admin").
        with(:pull => {:base => "master", :head => "pengwynn:master", :title => "Title", :body => "Body"}).
        to_return(:body => fixture("v2/pulls.json"))
      issues = @client.create_pull_request("sferik/rails_admin", "master", "pengwynn:master", "Title", "Body")
      issues.first.number.should == 251
    end

  end

  describe ".create_pull_request_for_issue" do

    it "should create a pull request and attach it to an existing issue" do
      stub_post("https://github.com/api/v2/json/pulls/pengwynn/octokit").
        with(:pull => {:base => "master", :head => "pengwynn:master", :issue => "34"}).
        to_return(:body => fixture("v2/pulls.json"))
      issues = @client.create_pull_request_for_issue("pengwynn/octokit", "master", "pengwynn:master", "34")
      issues.first.number.should == 251
    end

  end

  describe ".pull_requests" do

    it "should return all pull requests" do
      stub_get("https://github.com/api/v2/json/pulls/sferik/rails_admin/open").
        to_return(:body => fixture("v2/pulls.json"))
      pulls = @client.pulls("sferik/rails_admin")
      pulls.first.number.should == 251
    end

  end

  describe ".pull_request" do

    it "should return a pull request" do
      stub_get("https://github.com/api/v2/json/pulls/sferik/rails_admin/251").
        to_return(:body => fixture("v2/pull.json"))
      pull = @client.pull("sferik/rails_admin", 251)
      pull.number.should == 251
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
octokit-0.6.5 spec/octokit/client/pulls_spec.rb