Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/f2018071301 add option for warnings per pr review #304

Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4fab083
Add option for warnings per pr review
dimitrovv Jul 12, 2018
486862c
Use the warnings per pr review option to create consecutive pr reviews
dimitrovv Jul 12, 2018
685f61e
Add .idea to gitignore
dimitrovv Jul 12, 2018
48aa23e
Fix specs
dimitrovv Jul 12, 2018
8bb2cc4
Fix previously failing specs
dimitrovv Jul 12, 2018
bec326d
Remove extra empty line
dimitrovv Jul 12, 2018
1d039da
Extend config specs
dimitrovv Jul 12, 2018
60c683f
Fix and extend github specs
dimitrovv Jul 13, 2018
3f76cb4
Bump the version to 0.9.6
dimitrovv Jul 13, 2018
dfe7448
Change github client to work with a copy of comments
dimitrovv Jul 13, 2018
cca89f4
Extend github formatter specs
dimitrovv Jul 13, 2018
c546295
Restore version to 0.9.5
dimitrovv Jul 13, 2018
2d36014
Refactor github client spec
dimitrovv Jul 13, 2018
8a6e25e
Add info about the new config option in README.md
dimitrovv Jul 13, 2018
bf284c3
Use old hash syntax in specs to satisfy ruby 2.1.0
dimitrovv Jul 13, 2018
a43ece1
Remove ruby 2.0.0 from travis builds
dimitrovv Jul 13, 2018
1609117
Merge branch 'master' into feature/f2018071301-add_option_for_warning…
dimitrovv Jul 15, 2018
c561421
Restore .gitignore
dimitrovv Jul 15, 2018
90aacc8
Add default value of 30 to WARNING_PER_REVIEW
dimitrovv Jul 15, 2018
9c4573b
Restore specs' default codding standards
dimitrovv Jul 15, 2018
f2913c7
Update README.md
dimitrovv Jul 15, 2018
7df597e
Merge branch 'master' into feature/f2018071301-add_option_for_warning…
dimitrovv Jul 18, 2018
28a8b04
Merge branch 'master' into feature/f2018071301-add_option_for_warning…
dimitrovv May 15, 2019
a622d31
feature/f2018071301-add_option_for_warning_per_pr_review
dimitrovv May 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor github client spec
  • Loading branch information
dimitrovv committed Jul 13, 2018
commit 2d36014fa28976e42ef8ebc8d4d53e578cb10159
45 changes: 22 additions & 23 deletions spec/pronto/github_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ module Pronto
let(:github) { described_class.new(repo) }

let(:repo) do
double(remote_urls: ['[email protected]:prontolabs/pronto.git'], branch: nil, head_detached?: false)
double(remote_urls: ssh_remote_urls, branch: nil, head_detached?: false)
end

let(:sha) { '61e4bef' }
let(:comment) { double(body: 'note', path: 'path', line: 1, position: 1) }
let(:ssh_remote_urls) { ["[email protected]:#{github_slug}.git"] }
let(:github_slug) { 'prontolabs/pronto' }
let(:sha) { '61e4bef' }
let(:comment) { double(body: 'note', path: 'path', line: 1, position: 1) }
let(:empty_client_options) do
{
event: 'COMMENT',
event: 'COMMENT',
accept: 'application/vnd.github.black-cat-preview+json'
}
end
Expand All @@ -24,7 +26,7 @@ module Pronto
specify do
Octokit::Client.any_instance
.should_receive(:commit_comments)
.with('prontolabs/pronto', sha)
.with(github_slug, sha)
.once
.and_return([comment])

Expand All @@ -35,12 +37,12 @@ module Pronto
end

context 'git remote without .git suffix' do
let(:repo) { double(remote_urls: ['[email protected]:prontolabs/pronto']) }
let(:repo) { double(remote_urls: ssh_remote_urls) }

specify do
Octokit::Client.any_instance
.should_receive(:commit_comments)
.with('prontolabs/pronto', sha)
.with(github_slug, sha)
.once
.and_return([comment])

Expand All @@ -59,7 +61,7 @@ module Pronto
specify do
Octokit::Client.any_instance
.should_receive(:pull_comments)
.with('prontolabs/pronto', 10)
.with(github_slug, 10)
.once
.and_return([comment])

Expand Down Expand Up @@ -96,8 +98,8 @@ module Pronto

octokit_client
.should_receive(:create_status)
.with('prontolabs/pronto', expected_sha, state,
context: context, description: desc)
.with(github_slug, expected_sha, state, context: context,
description: desc)
.once
end

Expand Down Expand Up @@ -179,7 +181,7 @@ module Pronto
specify do
octokit_client
.should_receive(:create_pull_request_review)
.with('prontolabs/pronto', pull_id, options)
.with(github_slug, pull_id, options)
.once

subject
Expand All @@ -204,11 +206,11 @@ module Pronto
specify do
octokit_client
.should_receive(:create_pull_request_review)
.with('prontolabs/pronto', pull_id, first_options)
.with(github_slug, pull_id, first_options)
.once
octokit_client
.should_receive(:create_pull_request_review)
.with('prontolabs/pronto', pull_id, second_options)
.with(github_slug, pull_id, second_options)
.once

subject
Expand All @@ -217,13 +219,10 @@ module Pronto
end

context 'pull request for branch does not exist' do
let(:comments) do
[double(path: 'bad_file.rb', position: 10, body: 'Offense #1')]
end
let(:repo) do
double(remote_urls: ['[email protected]:prontolabs/pronto'],
branch: 'develop')
end

let(:comments) { [double(path: 'bad_file.rb', position: 10, body: 'Offense #1')] }
let(:repo) { double(remote_urls: ssh_remote_urls, branch: 'develop') }

specify do
octokit_client
.should_not_receive(:create_pull_request_review)
Expand All @@ -237,9 +236,9 @@ module Pronto
[double(path: 'bad_file.rb', position: 10, body: 'Offense #1')]
end
let(:repo) do
double(remote_urls: ['[email protected]:prontolabs/pronto'],
branch: nil,
head_detached?: true,
double(remote_urls: ssh_remote_urls,
branch: nil,
head_detached?: true,
head_commit_sha: 'sha_with_no_pr')
end
specify do
Expand Down