gitx 2.21.3 → 2.21.4.ci.145.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/README.md +0 -4
- data/lib/gitx/cli/base_command.rb +12 -11
- data/lib/gitx/cli/buildtag_command.rb +2 -2
- data/lib/gitx/cli/cleanup_command.rb +6 -6
- data/lib/gitx/cli/integrate_command.rb +6 -11
- data/lib/gitx/cli/nuke_command.rb +7 -8
- data/lib/gitx/cli/release_command.rb +4 -5
- data/lib/gitx/cli/review_command.rb +1 -1
- data/lib/gitx/cli/share_command.rb +2 -2
- data/lib/gitx/cli/track_command.rb +1 -1
- data/lib/gitx/cli/update_command.rb +3 -3
- data/lib/gitx/executor.rb +26 -0
- data/lib/gitx/extensions/thor.rb +0 -22
- data/lib/gitx/github.rb +2 -3
- data/lib/gitx/version.rb +1 -1
- data/spec/gitx/cli/buildtag_command_spec.rb +5 -4
- data/spec/gitx/cli/cleanup_command_spec.rb +11 -8
- data/spec/gitx/cli/integrate_command_spec.rb +55 -70
- data/spec/gitx/cli/nuke_command_spec.rb +25 -27
- data/spec/gitx/cli/release_command_spec.rb +46 -47
- data/spec/gitx/cli/review_command_spec.rb +8 -9
- data/spec/gitx/cli/share_command_spec.rb +4 -3
- data/spec/gitx/cli/start_command_spec.rb +8 -10
- data/spec/gitx/cli/track_command_spec.rb +3 -2
- data/spec/gitx/cli/update_command_spec.rb +12 -11
- data/spec/gitx/executor_spec.rb +41 -0
- metadata +48 -46
@@ -9,7 +9,8 @@ describe Gitx::Cli::IntegrateCommand do
|
|
9
9
|
pretend: true
|
10
10
|
}
|
11
11
|
end
|
12
|
-
let(:cli) {
|
12
|
+
let(:cli) { described_class.new(args, options, config) }
|
13
|
+
let(:executor) { cli.send(:executor) }
|
13
14
|
let(:current_branch) { double('fake branch', name: 'feature-branch', head?: true) }
|
14
15
|
let(:repo) { cli.send(:repo) }
|
15
16
|
let(:remote_branch_names) { ['origin/staging', 'origin/prototype'] }
|
@@ -29,14 +30,13 @@ describe Gitx::Cli::IntegrateCommand do
|
|
29
30
|
context 'when integration branch is ommitted and remote branch exists' do
|
30
31
|
let(:remote_branch_names) { ['origin/staging'] }
|
31
32
|
before do
|
32
|
-
expect(
|
33
|
-
|
34
|
-
expect(
|
35
|
-
expect(
|
36
|
-
expect(
|
37
|
-
expect(
|
38
|
-
expect(
|
39
|
-
expect(cli).to receive(:run_cmd).with('git checkout feature-branch').ordered
|
33
|
+
expect(executor).to receive(:execute).with('git', 'update').ordered
|
34
|
+
expect(executor).to receive(:execute).with('git', 'fetch', 'origin').ordered
|
35
|
+
expect(executor).to receive(:execute).with('git', 'branch', '--delete', '--force', 'staging').ordered
|
36
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'staging').ordered
|
37
|
+
expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', '[gitx] Integrating feature-branch into staging (Pull request #10)', 'feature-branch').ordered
|
38
|
+
expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
|
39
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
|
40
40
|
|
41
41
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
42
42
|
cli.integrate
|
@@ -51,14 +51,13 @@ describe Gitx::Cli::IntegrateCommand do
|
|
51
51
|
let(:local_branch_names) { ['master'] }
|
52
52
|
let(:remote_branch_names) { ['origin/staging'] }
|
53
53
|
before do
|
54
|
-
expect(
|
55
|
-
|
56
|
-
expect(
|
57
|
-
expect(
|
58
|
-
expect(
|
59
|
-
expect(
|
60
|
-
expect(
|
61
|
-
expect(cli).to receive(:run_cmd).with('git checkout master').ordered
|
54
|
+
expect(executor).to receive(:execute).with('git', 'update').ordered
|
55
|
+
expect(executor).to receive(:execute).with('git', 'fetch', 'origin').ordered
|
56
|
+
expect(executor).to receive(:execute).with('git', 'branch', '--delete', '--force', 'staging').ordered
|
57
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'staging').ordered
|
58
|
+
expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', '[gitx] Integrating master into staging', 'master').ordered
|
59
|
+
expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
|
60
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'master').ordered
|
62
61
|
|
63
62
|
cli.integrate
|
64
63
|
end
|
@@ -78,18 +77,20 @@ describe Gitx::Cli::IntegrateCommand do
|
|
78
77
|
}
|
79
78
|
}
|
80
79
|
end
|
80
|
+
let(:changelog) { '2013-01-01 did some stuff' }
|
81
81
|
before do
|
82
82
|
allow(cli).to receive(:ask_editor).and_return('description')
|
83
|
-
expect(cli).to receive(:execute_command).with(Gitx::Cli::UpdateCommand, :update).twice
|
84
83
|
|
85
|
-
expect(
|
86
|
-
expect(
|
87
|
-
expect(
|
88
|
-
expect(
|
89
|
-
expect(
|
90
|
-
expect(
|
91
|
-
expect(
|
92
|
-
expect(
|
84
|
+
expect(executor).to receive(:execute).with('git', 'update').ordered
|
85
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
|
86
|
+
expect(executor).to receive(:execute).with('git', 'update').ordered
|
87
|
+
expect(executor).to receive(:execute).with('git', 'log', 'master...feature-branch', '--reverse', '--no-merges', "--pretty=format:'* %B'").and_return(changelog).ordered
|
88
|
+
expect(executor).to receive(:execute).with('git', 'fetch', 'origin').ordered
|
89
|
+
expect(executor).to receive(:execute).with('git', 'branch', '--delete', '--force', 'staging').ordered
|
90
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'staging').ordered
|
91
|
+
expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', '[gitx] Integrating feature-branch into staging (Pull request #10)', 'feature-branch').ordered
|
92
|
+
expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
|
93
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
|
93
94
|
|
94
95
|
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' })
|
95
96
|
|
@@ -107,18 +108,16 @@ describe Gitx::Cli::IntegrateCommand do
|
|
107
108
|
context 'when staging branch does not exist remotely' do
|
108
109
|
let(:remote_branch_names) { [] }
|
109
110
|
before do
|
110
|
-
expect(cli).to receive(:execute_command).with(Gitx::Cli::UpdateCommand, :update)
|
111
|
-
|
112
111
|
expect(repo).to receive(:create_branch).with('staging', 'master')
|
113
112
|
|
114
|
-
expect(
|
115
|
-
|
116
|
-
expect(
|
117
|
-
expect(
|
118
|
-
expect(
|
119
|
-
expect(
|
120
|
-
expect(
|
121
|
-
expect(
|
113
|
+
expect(executor).to receive(:execute).with('git', 'update').ordered
|
114
|
+
expect(executor).to receive(:execute).with('git', 'push', 'origin', 'staging:staging').ordered
|
115
|
+
expect(executor).to receive(:execute).with('git', 'fetch', 'origin').ordered
|
116
|
+
expect(executor).to receive(:execute).with('git', 'branch', '--delete', '--force', 'staging').and_raise(Gitx::Executor::ExecutionError).ordered
|
117
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'staging').ordered
|
118
|
+
expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', '[gitx] Integrating feature-branch into staging (Pull request #10)', 'feature-branch').ordered
|
119
|
+
expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
|
120
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
|
122
121
|
|
123
122
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
124
123
|
cli.integrate
|
@@ -131,14 +130,13 @@ describe Gitx::Cli::IntegrateCommand do
|
|
131
130
|
context 'when integration branch == prototype and remote branch exists' do
|
132
131
|
let(:remote_branch_names) { ['origin/prototype'] }
|
133
132
|
before do
|
134
|
-
expect(
|
135
|
-
|
136
|
-
expect(
|
137
|
-
expect(
|
138
|
-
expect(
|
139
|
-
expect(
|
140
|
-
expect(
|
141
|
-
expect(cli).to receive(:run_cmd).with('git checkout feature-branch').ordered
|
133
|
+
expect(executor).to receive(:execute).with('git', 'update').ordered
|
134
|
+
expect(executor).to receive(:execute).with('git', 'fetch', 'origin').ordered
|
135
|
+
expect(executor).to receive(:execute).with('git', 'branch', '--delete', '--force', 'prototype').ordered
|
136
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'prototype').ordered
|
137
|
+
expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', '[gitx] Integrating feature-branch into prototype (Pull request #10)', 'feature-branch').ordered
|
138
|
+
expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
|
139
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
|
142
140
|
|
143
141
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
144
142
|
cli.integrate 'prototype'
|
@@ -153,26 +151,14 @@ describe Gitx::Cli::IntegrateCommand do
|
|
153
151
|
expect { cli.integrate('some-other-branch') }.to raise_error(/Invalid aggregate branch: some-other-branch must be one of supported aggregate branches/)
|
154
152
|
end
|
155
153
|
end
|
156
|
-
context 'when merge conflicts occur during the Gitx::Cli::UpdateCommand execution' do
|
157
|
-
let(:remote_branch_names) { ['origin/staging'] }
|
158
|
-
before do
|
159
|
-
expect(cli).to receive(:execute_command).with(Gitx::Cli::UpdateCommand, :update).and_raise(Gitx::Cli::BaseCommand::MergeError)
|
160
|
-
|
161
|
-
expect { cli.integrate }.to raise_error(Gitx::Cli::BaseCommand::MergeError, 'Merge conflict occurred. Please fix merge conflict and rerun the integrate command')
|
162
|
-
end
|
163
|
-
it 'raises a helpful error' do
|
164
|
-
should meet_expectations
|
165
|
-
end
|
166
|
-
end
|
167
154
|
context 'when merge conflicts occur with the integrate command' do
|
168
155
|
let(:remote_branch_names) { ['origin/staging'] }
|
169
156
|
before do
|
170
|
-
expect(
|
171
|
-
|
172
|
-
expect(
|
173
|
-
expect(
|
174
|
-
expect(
|
175
|
-
expect(cli).to receive(:run_cmd).with('git merge --no-ff -m "[gitx] Integrating feature-branch into staging (Pull request #10)" feature-branch').and_raise('git merge feature-branch failed').ordered
|
157
|
+
expect(executor).to receive(:execute).with('git', 'update').ordered
|
158
|
+
expect(executor).to receive(:execute).with('git', 'fetch', 'origin').ordered
|
159
|
+
expect(executor).to receive(:execute).with('git', 'branch', '--delete', '--force', 'staging').ordered
|
160
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'staging').ordered
|
161
|
+
expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', '[gitx] Integrating feature-branch into staging (Pull request #10)', 'feature-branch').and_raise('git merge feature-branch failed').ordered
|
176
162
|
|
177
163
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
178
164
|
expect { cli.integrate }.to raise_error(/Merge conflict occurred. Please fix merge conflict and rerun command with --resume feature-branch flag/)
|
@@ -190,11 +176,10 @@ describe Gitx::Cli::IntegrateCommand do
|
|
190
176
|
end
|
191
177
|
let(:repo) { cli.send(:repo) }
|
192
178
|
before do
|
193
|
-
expect(
|
194
|
-
|
195
|
-
expect(
|
196
|
-
expect(
|
197
|
-
expect(cli).to receive(:run_cmd).with('git checkout feature-branch')
|
179
|
+
expect(executor).to receive(:execute).with('git', 'update').ordered
|
180
|
+
expect(executor).not_to receive(:execute).with('git', 'branch', '--delete', '--force', 'staging')
|
181
|
+
expect(executor).not_to receive(:execute).with('git', 'push', 'origin', 'HEAD')
|
182
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch')
|
198
183
|
|
199
184
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
200
185
|
cli.integrate
|
@@ -212,12 +197,12 @@ describe Gitx::Cli::IntegrateCommand do
|
|
212
197
|
end
|
213
198
|
let(:local_branch_names) { ['feature-branch'] }
|
214
199
|
before do
|
215
|
-
expect(
|
200
|
+
expect(executor).to receive(:execute).with('git', 'update').ordered
|
216
201
|
expect(cli).to receive(:ask).and_return('feature-branch')
|
217
202
|
|
218
|
-
expect(
|
219
|
-
expect(
|
220
|
-
expect(
|
203
|
+
expect(executor).not_to receive(:execute).with('git', 'branch', '--delete', '--force', 'staging')
|
204
|
+
expect(executor).not_to receive(:execute).with('git', 'push', 'origin', 'HEAD')
|
205
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
|
221
206
|
|
222
207
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
223
208
|
cli.integrate
|
@@ -9,7 +9,8 @@ describe Gitx::Cli::NukeCommand do
|
|
9
9
|
pretend: true
|
10
10
|
}
|
11
11
|
end
|
12
|
-
let(:cli) {
|
12
|
+
let(:cli) { described_class.new(args, options, config) }
|
13
|
+
let(:executor) { cli.send(:executor) }
|
13
14
|
let(:branch) { double('fake branch', name: 'feature-branch') }
|
14
15
|
|
15
16
|
before do
|
@@ -31,13 +32,12 @@ describe Gitx::Cli::NukeCommand do
|
|
31
32
|
|
32
33
|
expect(cli).to receive(:current_build_tag).with(good_branch).and_return(buildtag)
|
33
34
|
|
34
|
-
expect(
|
35
|
-
expect(
|
36
|
-
expect(
|
37
|
-
expect(
|
38
|
-
expect(
|
39
|
-
expect(
|
40
|
-
expect(cli).to receive(:run_cmd).with('git checkout master').ordered
|
35
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'master').ordered
|
36
|
+
expect(executor).to receive(:execute).with('git', 'branch', '--delete', '--force', 'prototype').ordered
|
37
|
+
expect(executor).to receive(:execute).with('git', 'push', 'origin', '--delete', 'prototype').ordered
|
38
|
+
expect(executor).to receive(:execute).with('git', 'checkout', '-b', 'prototype', 'build-master-2013-10-01-01').ordered
|
39
|
+
expect(executor).to receive(:execute).with('git', 'share').ordered
|
40
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'master').ordered
|
41
41
|
|
42
42
|
cli.nuke bad_branch
|
43
43
|
end
|
@@ -55,13 +55,12 @@ describe Gitx::Cli::NukeCommand do
|
|
55
55
|
|
56
56
|
expect(cli).to receive(:current_build_tag).with(good_branch).and_return(buildtag)
|
57
57
|
|
58
|
-
expect(
|
59
|
-
expect(
|
60
|
-
expect(
|
61
|
-
expect(
|
62
|
-
expect(
|
63
|
-
expect(
|
64
|
-
expect(cli).to receive(:run_cmd).with('git checkout master').ordered
|
58
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'master').ordered
|
59
|
+
expect(executor).to receive(:execute).with('git', 'branch', '--delete', '--force', 'prototype').ordered
|
60
|
+
expect(executor).to receive(:execute).with('git', 'push', 'origin', '--delete', 'prototype').ordered
|
61
|
+
expect(executor).to receive(:execute).with('git', 'checkout', '-b', 'prototype', 'build-master-2013-10-01-01').ordered
|
62
|
+
expect(executor).to receive(:execute).with('git', 'share').ordered
|
63
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'master').ordered
|
65
64
|
|
66
65
|
cli.nuke 'prototype'
|
67
66
|
end
|
@@ -77,7 +76,7 @@ describe Gitx::Cli::NukeCommand do
|
|
77
76
|
|
78
77
|
expect(cli).to receive(:current_build_tag).with('master').and_return(buildtag)
|
79
78
|
|
80
|
-
expect(
|
79
|
+
expect(executor).to_not receive(:execute)
|
81
80
|
|
82
81
|
cli.nuke 'prototype'
|
83
82
|
end
|
@@ -95,8 +94,8 @@ describe Gitx::Cli::NukeCommand do
|
|
95
94
|
let(:bad_branch) { 'prototype' }
|
96
95
|
let(:buildtags) { '' }
|
97
96
|
it 'raises error' do
|
98
|
-
expect(
|
99
|
-
expect(
|
97
|
+
expect(executor).to receive(:execute).with('git', 'fetch', '--tags').ordered
|
98
|
+
expect(executor).to receive(:execute).with('git', 'tag', '--list', 'build-master-*').and_return(buildtags).ordered
|
100
99
|
|
101
100
|
expect { cli.nuke('prototype') }.to raise_error(/No known good tag found for branch/)
|
102
101
|
end
|
@@ -115,7 +114,7 @@ describe Gitx::Cli::NukeCommand do
|
|
115
114
|
|
116
115
|
expect(cli).to receive(:ask).and_return(good_branch)
|
117
116
|
expect(cli).to receive(:yes?).with('Reset prototype to build-master-2013-10-01-01? (y/n)', :green).and_return(true)
|
118
|
-
expect(
|
117
|
+
expect(executor).to receive(:execute).with('git', 'diff', 'build-master-2013-10-01-01...prototype', '--name-only', 'db/migrate').and_return(migrations)
|
119
118
|
expect(cli).to receive(:yes?).with('Are you sure you want to nuke prototype? (y/n) ', :green).and_return(false)
|
120
119
|
|
121
120
|
cli.nuke 'prototype'
|
@@ -141,16 +140,15 @@ describe Gitx::Cli::NukeCommand do
|
|
141
140
|
|
142
141
|
expect(cli).to receive(:ask).and_return(good_branch)
|
143
142
|
expect(cli).to receive(:yes?).with('Reset prototype to build-master-2013-10-01-01? (y/n)', :green).and_return(true)
|
144
|
-
expect(
|
143
|
+
expect(executor).to receive(:execute).with('git', 'diff', 'build-master-2013-10-01-01...prototype', '--name-only', 'db/migrate').and_return(migrations)
|
145
144
|
expect(cli).to receive(:yes?).with('Are you sure you want to nuke prototype? (y/n) ', :green).and_return(true)
|
146
145
|
|
147
|
-
expect(
|
148
|
-
expect(
|
149
|
-
expect(
|
150
|
-
expect(
|
151
|
-
expect(
|
152
|
-
expect(
|
153
|
-
expect(cli).to receive(:run_cmd).with('git checkout master').ordered
|
146
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'master').ordered
|
147
|
+
expect(executor).to receive(:execute).with('git', 'branch', '--delete', '--force', 'prototype').ordered
|
148
|
+
expect(executor).to receive(:execute).with('git', 'push', 'origin', '--delete', 'prototype').ordered
|
149
|
+
expect(executor).to receive(:execute).with('git', 'checkout', '-b', 'prototype', 'build-master-2013-10-01-01').ordered
|
150
|
+
expect(executor).to receive(:execute).with('git', 'share').ordered
|
151
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'master').ordered
|
154
152
|
|
155
153
|
cli.nuke 'prototype'
|
156
154
|
end
|
@@ -13,6 +13,7 @@ describe Gitx::Cli::ReleaseCommand do
|
|
13
13
|
let(:branch) { double('fake branch', name: 'feature-branch') }
|
14
14
|
let(:authorization_token) { '123123' }
|
15
15
|
let(:repo) { cli.send(:repo) }
|
16
|
+
let(:executor) { cli.send(:executor) }
|
16
17
|
|
17
18
|
before do
|
18
19
|
allow(cli).to receive(:current_branch).and_return(branch)
|
@@ -22,7 +23,7 @@ describe Gitx::Cli::ReleaseCommand do
|
|
22
23
|
context 'when user rejects release' do
|
23
24
|
before do
|
24
25
|
expect(cli).to receive(:yes?).and_return(false)
|
25
|
-
expect(
|
26
|
+
expect(executor).to_not receive(:execute)
|
26
27
|
|
27
28
|
cli.release
|
28
29
|
end
|
@@ -33,16 +34,16 @@ describe Gitx::Cli::ReleaseCommand do
|
|
33
34
|
context 'when user confirms release and pull request exists with non-success status' do
|
34
35
|
before do
|
35
36
|
expect(repo).to receive(:workdir).and_return(temp_dir)
|
36
|
-
expect(cli).to receive(:execute_command).with(Gitx::Cli::UpdateCommand, :update)
|
37
37
|
|
38
38
|
expect(cli).to receive(:yes?).with('Release feature-branch to master? (y/n)', :green).and_return(true)
|
39
39
|
expect(cli).to receive(:yes?).with('Branch status is currently: failure. Proceed with release? (y/n)', :red).and_return(false)
|
40
40
|
allow(cli).to receive(:authorization_token).and_return(authorization_token)
|
41
41
|
|
42
|
-
expect(
|
43
|
-
expect(
|
44
|
-
expect(
|
45
|
-
expect(
|
42
|
+
expect(executor).to receive(:execute).with('git', 'update').ordered
|
43
|
+
expect(executor).to_not receive(:execute).with('git', 'checkout', 'master')
|
44
|
+
expect(executor).to_not receive(:execute).with('git', 'pull', 'origin', 'master')
|
45
|
+
expect(executor).to_not receive(:execute).with('git', 'merge', '--no-ff', '--message', '[gitx] Releasing feature-branch to master (Pull request #10)', 'feature-branch')
|
46
|
+
expect(executor).to_not receive(:execute).with('git', 'push', 'origin', 'HEAD')
|
46
47
|
|
47
48
|
VCR.use_cassette('pull_request_does_exist_with_failure_status') do
|
48
49
|
cli.release
|
@@ -56,17 +57,16 @@ describe Gitx::Cli::ReleaseCommand do
|
|
56
57
|
before do
|
57
58
|
expect(repo).to receive(:workdir).and_return(temp_dir)
|
58
59
|
|
59
|
-
expect(cli).to receive(:execute_command).with(Gitx::Cli::UpdateCommand, :update)
|
60
|
-
|
61
60
|
expect(cli).to receive(:yes?).and_return(true)
|
62
61
|
allow(cli).to receive(:authorization_token).and_return(authorization_token)
|
63
62
|
|
64
|
-
expect(
|
65
|
-
expect(
|
66
|
-
expect(
|
67
|
-
expect(
|
68
|
-
expect(
|
69
|
-
expect(
|
63
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
|
64
|
+
expect(executor).to receive(:execute).with('git', 'update').ordered
|
65
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'master').ordered
|
66
|
+
expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'master').ordered
|
67
|
+
expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', '[gitx] Releasing feature-branch to master (Pull request #10)', 'feature-branch').ordered
|
68
|
+
expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
|
69
|
+
expect(executor).to receive(:execute).with('git integrate').ordered
|
70
70
|
|
71
71
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
72
72
|
cli.release
|
@@ -87,17 +87,16 @@ describe Gitx::Cli::ReleaseCommand do
|
|
87
87
|
File.open(File.join(temp_dir, '.gitx.yml'), 'w') do |f|
|
88
88
|
f.puts gitx_config.to_yaml
|
89
89
|
end
|
90
|
-
expect(cli).to receive(:execute_command).with(Gitx::Cli::UpdateCommand, :update)
|
91
|
-
|
92
90
|
expect(cli).to receive(:yes?).and_return(true)
|
93
91
|
allow(cli).to receive(:authorization_token).and_return(authorization_token)
|
94
92
|
|
95
|
-
expect(
|
96
|
-
expect(
|
97
|
-
expect(
|
98
|
-
expect(
|
99
|
-
expect(
|
100
|
-
expect(
|
93
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
|
94
|
+
expect(executor).to receive(:execute).with('git', 'update').ordered
|
95
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'master').ordered
|
96
|
+
expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'master').ordered
|
97
|
+
expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', '[gitx] Releasing feature-branch to master (Pull request #10)', 'feature-branch').ordered
|
98
|
+
expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
|
99
|
+
expect(executor).to receive(:execute).with('echo hello').ordered
|
101
100
|
|
102
101
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
103
102
|
cli.release
|
@@ -110,17 +109,17 @@ describe Gitx::Cli::ReleaseCommand do
|
|
110
109
|
context 'when target_branch is not nil and user confirms release and pull request exists with success status' do
|
111
110
|
before do
|
112
111
|
expect(repo).to receive(:workdir).and_return(temp_dir)
|
113
|
-
expect(cli).to receive(:execute_command).with(Gitx::Cli::UpdateCommand, :update)
|
114
112
|
|
115
113
|
expect(cli).to receive(:yes?).and_return(true)
|
116
114
|
allow(cli).to receive(:authorization_token).and_return(authorization_token)
|
117
115
|
|
118
|
-
expect(
|
119
|
-
expect(
|
120
|
-
expect(
|
121
|
-
expect(
|
122
|
-
expect(
|
123
|
-
expect(
|
116
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
|
117
|
+
expect(executor).to receive(:execute).with('git', 'update').ordered
|
118
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'master').ordered
|
119
|
+
expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'master').ordered
|
120
|
+
expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', '[gitx] Releasing feature-branch to master (Pull request #10)', 'feature-branch').ordered
|
121
|
+
expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
|
122
|
+
expect(executor).to receive(:execute).with('git integrate').ordered
|
124
123
|
|
125
124
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
126
125
|
cli.release 'feature-branch'
|
@@ -146,19 +145,19 @@ describe Gitx::Cli::ReleaseCommand do
|
|
146
145
|
allow(cli).to receive(:authorization_token).and_return(authorization_token)
|
147
146
|
allow(cli).to receive(:ask_editor).and_return('description')
|
148
147
|
|
149
|
-
expect(cli).to receive(:execute_command).with(Gitx::Cli::UpdateCommand, :update).twice
|
150
|
-
|
151
148
|
expect(cli).to receive(:yes?).with('Release feature-branch to master? (y/n)', :green).and_return(true)
|
152
149
|
expect(cli).to receive(:yes?).with('Branch status is currently: pending. Proceed with release? (y/n)', :red).and_return(true)
|
153
150
|
|
154
|
-
expect(
|
155
|
-
expect(
|
156
|
-
expect(
|
157
|
-
expect(
|
158
|
-
expect(
|
159
|
-
expect(
|
160
|
-
expect(
|
161
|
-
expect(
|
151
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
|
152
|
+
expect(executor).to receive(:execute).with('git', 'update').ordered
|
153
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
|
154
|
+
expect(executor).to receive(:execute).with('git', 'update').ordered
|
155
|
+
expect(executor).to receive(:execute).with('git', 'log', 'master...feature-branch', '--reverse', '--no-merges', "--pretty=format:'* %B'").and_return('2013-01-01 did some stuff').ordered
|
156
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'master').ordered
|
157
|
+
expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'master').ordered
|
158
|
+
expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', '[gitx] Releasing feature-branch to master (Pull request #10)', 'feature-branch').ordered
|
159
|
+
expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
|
160
|
+
expect(executor).to receive(:execute).with('git integrate').ordered
|
162
161
|
|
163
162
|
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' })
|
164
163
|
VCR.use_cassette('pull_request_does_not_exist') do
|
@@ -180,18 +179,18 @@ describe Gitx::Cli::ReleaseCommand do
|
|
180
179
|
end
|
181
180
|
before do
|
182
181
|
expect(repo).to receive(:workdir).and_return(temp_dir)
|
183
|
-
expect(cli).to receive(:execute_command).with(Gitx::Cli::UpdateCommand, :update)
|
184
182
|
|
185
183
|
expect(cli).to receive(:yes?).and_return(true)
|
186
184
|
allow(cli).to receive(:authorization_token).and_return(authorization_token)
|
187
185
|
|
188
|
-
expect(
|
189
|
-
expect(
|
190
|
-
expect(
|
191
|
-
expect(
|
192
|
-
expect(
|
193
|
-
expect(
|
194
|
-
expect(
|
186
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'feature-branch').ordered
|
187
|
+
expect(executor).to receive(:execute).with('git', 'update').ordered
|
188
|
+
expect(executor).to receive(:execute).with('git', 'checkout', 'master').ordered
|
189
|
+
expect(executor).to receive(:execute).with('git', 'pull', 'origin', 'master').ordered
|
190
|
+
expect(executor).to receive(:execute).with('git', 'merge', '--no-ff', '--message', '[gitx] Releasing feature-branch to master (Pull request #10)', 'feature-branch').ordered
|
191
|
+
expect(executor).to receive(:execute).with('git', 'push', 'origin', 'HEAD').ordered
|
192
|
+
expect(executor).to receive(:execute).with('git integrate').ordered
|
193
|
+
expect(executor).to receive(:execute).with('git cleanup').ordered
|
195
194
|
|
196
195
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
197
196
|
cli.release
|