spec/gitx/cli/integrate_command_spec.rb in gitx-2.18.0 vs spec/gitx/cli/integrate_command_spec.rb in gitx-2.19.0.ci.112.1
- old
+ new
@@ -36,23 +36,17 @@
expect(cli).to receive(:run_cmd).with('git checkout staging').ordered
expect(cli).to receive(:run_cmd).with('git merge --no-ff -m "[gitx] Integrating feature-branch into staging (Pull request #10)" feature-branch').ordered
expect(cli).to receive(:run_cmd).with('git push origin HEAD').ordered
expect(cli).to receive(:run_cmd).with('git checkout feature-branch').ordered
- stub_request(:post, /.*api.github.com.*/).to_return(status: 201)
-
VCR.use_cassette('pull_request_does_exist_with_success_status') do
cli.integrate
end
end
it 'defaults to staging branch' do
should meet_expectations
end
- it 'posts comment to pull request' do
- expect(WebMock).to have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/issues/10/comments')
- .with(body: { body: '[gitx] integrated into staging :twisted_rightwards_arrows:' })
- end
end
context 'when current_branch == master' do
let(:current_branch) { double('fake branch', name: 'master', head?: true) }
let(:local_branch_names) { ['master'] }
let(:remote_branch_names) { ['origin/staging'] }
@@ -69,13 +63,10 @@
cli.integrate
end
it 'does not create pull request' do
expect(WebMock).to_not have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/pulls')
end
- it 'does not post comment on pull request' do
- expect(WebMock).to_not have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/issues/10/comments')
- end
end
context 'when a pull request doesnt exist for the feature-branch' do
let(:changelog) { '* made some fixes' }
let(:new_pull_request) do
{
@@ -99,23 +90,18 @@
expect(cli).to receive(:run_cmd).with('git merge --no-ff -m "[gitx] Integrating feature-branch into staging (Pull request #10)" feature-branch').ordered
expect(cli).to receive(:run_cmd).with('git push origin HEAD').ordered
expect(cli).to receive(:run_cmd).with('git checkout feature-branch').ordered
stub_request(:post, 'https://api.github.com/repos/wireframe/gitx/pulls').to_return(status: 201, body: new_pull_request.to_json, headers: { 'Content-Type' => 'application/json' })
- stub_request(:post, 'https://api.github.com/repos/wireframe/gitx/issues/10/comments').to_return(status: 201)
VCR.use_cassette('pull_request_does_not_exist') do
cli.integrate
end
end
it 'creates github pull request' do
should meet_expectations
end
- it 'creates github comment for integration' do
- expect(WebMock).to have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/issues/10/comments')
- .with(body: { body: '[gitx] integrated into staging :twisted_rightwards_arrows:' })
- end
it 'runs expected commands' do
should meet_expectations
end
end
context 'when staging branch does not exist remotely' do
@@ -132,12 +118,10 @@
expect(cli).to receive(:run_cmd).with('git checkout staging').ordered
expect(cli).to receive(:run_cmd).with('git merge --no-ff -m "[gitx] Integrating feature-branch into staging (Pull request #10)" feature-branch').ordered
expect(cli).to receive(:run_cmd).with('git push origin HEAD').ordered
expect(cli).to receive(:run_cmd).with('git checkout feature-branch').ordered
- stub_request(:post, /.*api.github.com.*/).to_return(status: 201)
-
VCR.use_cassette('pull_request_does_exist_with_success_status') do
cli.integrate
end
end
it 'creates remote aggregate branch' do
@@ -154,12 +138,10 @@
expect(cli).to receive(:run_cmd).with('git checkout prototype').ordered
expect(cli).to receive(:run_cmd).with('git merge --no-ff -m "[gitx] Integrating feature-branch into prototype (Pull request #10)" feature-branch').ordered
expect(cli).to receive(:run_cmd).with('git push origin HEAD').ordered
expect(cli).to receive(:run_cmd).with('git checkout feature-branch').ordered
- stub_request(:post, /.*api.github.com.*/).to_return(status: 201)
-
VCR.use_cassette('pull_request_does_exist_with_success_status') do
cli.integrate 'prototype'
end
end
it 'runs expected commands' do
@@ -212,12 +194,10 @@
expect(cli).not_to receive(:run_cmd).with('git branch -D staging')
expect(cli).not_to receive(:run_cmd).with('git push origin HEAD')
expect(cli).to receive(:run_cmd).with('git checkout feature-branch')
- stub_request(:post, /.*api.github.com.*/).to_return(status: 201)
-
VCR.use_cassette('pull_request_does_exist_with_success_status') do
cli.integrate
end
end
it 'does not delete local staging branch' do
@@ -237,10 +217,9 @@
expect(cli).not_to receive(:run_cmd).with('git branch -D staging')
expect(cli).not_to receive(:run_cmd).with('git push origin HEAD')
expect(cli).to receive(:run_cmd).with('git checkout feature-branch').ordered
- stub_request(:post, /.*api.github.com.*/).to_return(status: 201)
VCR.use_cassette('pull_request_does_exist_with_success_status') do
cli.integrate
end
end
it 'asks user for feature-branch name' do