Sha256: ed763f840ae79d4b3b956f5766d345b6443f96dad3c6596eda3e217934f21769
Contents?: true
Size: 1.42 KB
Versions: 6
Compression:
Stored size: 1.42 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Github::PullRequests, '#commits' do let(:repo) { 'github' } let(:user) { 'peter-murach' } let(:number) { 1 } let(:request_path) { "/repos/#{user}/#{repo}/pulls/#{number}/commits" } before { stub_get(request_path).to_return(:body => body, :status => status, :headers => {:content_type => "application/json; charset=utf-8"}) } after { reset_authentication_for(subject) } context 'resource found' do let(:body) { fixture('pull_requests/commits.json') } let(:status) { 200 } it "throws error if pull_request_id not provided" do expect { subject.commits user, repo, nil }.to raise_error(ArgumentError) end it "should get the resources" do subject.commits user, repo, number a_get(request_path).should have_been_made end it_should_behave_like 'an array of resources' do let(:requestable) { subject.commits user, repo, number } end it "should get pull request information" do pull_requests = subject.commits user, repo, number pull_requests.first.committer.name.should == 'Scott Chacon' end it "should yield to a block" do yielded = [] result = subject.commits(user, repo, number) { |obj| yielded << obj } yielded.should == result end end it_should_behave_like 'request failure' do let(:requestable) { subject.commits user, repo, number } end end # commits
Version data entries
6 entries across 6 versions & 1 rubygems