Sha256: 95c436ec2568f13416a50decc05016680bf1da1f9e57697e1836c8ed25432c98

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

# encoding: utf-8

require 'spec_helper'

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

  before { reset_authentication_for(subject) }
  after  { reset_authentication_for(subject) }

  context "checks whetehr pull request has been merged" do
    before {
      stub_get(request_path).to_return(:body => "[]", :status => 404,
        :headers => {:user_agent => subject.user_agent})
    }

    it "should fail validation " do
      expect { subject.merged?(nil, nil, number) }.to raise_error(ArgumentError)
    end

    it "should return false if resource not found" do
      merged = subject.merged? user, repo, number
      merged.should be_false
    end

    it "should return true if resoure found" do
      stub_get(request_path).to_return(:body => "[]", :status => 200,
        :headers => {:user_agent => subject.user_agent})
      merged = subject.merged? user, repo, number
      merged.should be_true
    end
  end
end # merged?

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
github_api-0.9.0 spec/github/pull_requests/merged_spec.rb
github_api-0.8.11 spec/github/pull_requests/merged_spec.rb
github_api-0.8.10 spec/github/pull_requests/merged_spec.rb
github_api-0.8.9 spec/github/pull_requests/merged_spec.rb
github_api-0.8.8 spec/github/pull_requests/merged_spec.rb
github_api-0.8.7 spec/github/pull_requests/merged_spec.rb