Sha256: a72ed71f797d8550ce2386cf0fe36bb8f2fb39544f4f2dc35ce7dd8bbf29e466

Contents?: true

Size: 1.13 KB

Versions: 14

Compression:

Stored size: 1.13 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 { expect { subject.merged? }.to raise_error(ArgumentError) }

    it "should fail validation " do
      expect { subject.merged?(user, repo) }.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

14 entries across 14 versions & 1 rubygems

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