forked from prontolabs/pronto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Github to receive repo via constructor
Simplifies the whole class and moves the slug parsing to a more natural place.
- Loading branch information
Showing
8 changed files
with
71 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,18 +2,19 @@ | |
|
||
module Pronto | ||
describe Github do | ||
let(:github) { Github.new } | ||
let(:github) { Github.new(repo) } | ||
|
||
describe '#commit_comments' do | ||
subject { github.commit_comments(repo, sha) } | ||
subject { github.commit_comments(sha) } | ||
|
||
context 'three requests for same comments' do | ||
let(:repo) { double(github_slug: 'mmozuras/pronto') } | ||
let(:repo) { double(remote_urls: ['[email protected]:mmozuras/pronto.git']) } | ||
let(:sha) { '61e4bef' } | ||
|
||
specify do | ||
Octokit::Client.any_instance | ||
.should_receive(:commit_comments) | ||
.with('mmozuras/pronto', sha) | ||
.once | ||
.and_return([]) | ||
|
||
|
@@ -23,5 +24,28 @@ module Pronto | |
end | ||
end | ||
end | ||
|
||
describe '#pull_comments' do | ||
subject { github.pull_comments(sha) } | ||
|
||
context 'three requests for same comments' do | ||
let(:repo) { double(remote_urls: ['https://github.com/mmozuras/pronto.git']) } | ||
let(:sha) { '61e4bef' } | ||
|
||
specify do | ||
Octokit::Client.any_instance | ||
.should_receive(:pull_comments) | ||
.with('mmozuras/pronto', 10) | ||
.once | ||
.and_return([]) | ||
|
||
ENV['PULL_REQUEST_ID'] = '10' | ||
|
||
subject | ||
subject | ||
subject | ||
end | ||
end | ||
end | ||
end | ||
end |