Sha256: f4411532d5b97b3671a80ff458b4158b541e22ea100b0922b03afee33ab983c9

Contents?: true

Size: 1.04 KB

Versions: 14

Compression:

Stored size: 1.04 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Repos::Commits, '#compare' do
  let(:user) { 'peter-murach' }
  let(:repo) { 'github' }
  let(:base) { 'master' }
  let(:head) { 'topic' }
  let(:request_path) { "/repos/#{user}/#{repo}/compare/#{base}...#{head}" }

  before {
    stub_get(request_path).
      to_return(:body => fixture('repos/commit_comparison.json'),
        :status => 200,
        :headers => {:content_type => "application/json; charset=utf-8"})
  }

  after { reset_authentication_for(subject) }

  it { expect { subject.compare }.to raise_error(ArgumentError) }

  it "should fail to get resource without base" do
    expect { subject.compare user, repo, nil, head }.to raise_error(ArgumentError)
  end

  it "should compare successfully" do
    subject.compare user, repo, base, head
    a_get(request_path).should have_been_made
  end

  it "should get comparison information" do
    commit = subject.compare user, repo, base, head
    commit.base_commit.commit.author.name.should == 'Monalisa Octocat'
  end

end # compare

Version data entries

14 entries across 14 versions & 1 rubygems

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