git_helper 3.3.2 → 3.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +29 -20
- data/README.md +4 -4
- data/lib/git_helper.rb +1 -1
- data/lib/git_helper/change_remote.rb +6 -5
- data/lib/git_helper/code_request.rb +10 -9
- data/lib/git_helper/merge_request.rb +7 -7
- data/lib/git_helper/new_branch.rb +1 -1
- data/lib/git_helper/pull_request.rb +6 -6
- data/lib/git_helper/setup.rb +19 -19
- data/lib/git_helper/version.rb +1 -1
- data/spec/git_helper/change_remote_spec.rb +7 -7
- data/spec/git_helper/code_request_spec.rb +28 -28
- data/spec/git_helper/merge_request_spec.rb +16 -16
- data/spec/git_helper/new_branch_spec.rb +8 -8
- data/spec/git_helper/pull_request_spec.rb +15 -15
- data/spec/git_helper/setup_spec.rb +22 -19
- data/spec/spec_helper.rb +1 -0
- metadata +38 -13
- data/lib/git_helper/highline_cli.rb +0 -35
- data/spec/git_helper/highline_cli_spec.rb +0 -53
data/lib/git_helper/version.rb
CHANGED
@@ -6,7 +6,7 @@ require 'git_helper'
|
|
6
6
|
describe GitHelper::ChangeRemote do
|
7
7
|
let(:remote1) { "git@github.com:#{old_owner}/#{project}.git" }
|
8
8
|
let(:project) { Faker::Lorem.word }
|
9
|
-
let(:
|
9
|
+
let(:highline_wrapper) { double(:highline_wrapper, ask_yes_no: true) }
|
10
10
|
let(:old_owner) { Faker::Internet.username }
|
11
11
|
let(:new_owner) { Faker::Internet.username }
|
12
12
|
let(:directory_entries) { ['.', '..', project, Faker::Lorem.word, Faker::Lorem.word] }
|
@@ -25,7 +25,7 @@ describe GitHelper::ChangeRemote do
|
|
25
25
|
subject { GitHelper::ChangeRemote.new(old_owner, new_owner) }
|
26
26
|
|
27
27
|
before do
|
28
|
-
allow(
|
28
|
+
allow(HighlineWrapper).to receive(:new).and_return(highline_wrapper)
|
29
29
|
allow(GitHelper::LocalCode).to receive(:new).and_return(local_code)
|
30
30
|
allow(subject).to receive(:puts)
|
31
31
|
end
|
@@ -74,7 +74,7 @@ describe GitHelper::ChangeRemote do
|
|
74
74
|
end
|
75
75
|
|
76
76
|
context 'when the user says not to process the directory' do
|
77
|
-
let(:
|
77
|
+
let(:highline_wrapper) { double(:highline_wrapper, ask_yes_no: false) }
|
78
78
|
|
79
79
|
it 'should not call to process the directory' do
|
80
80
|
expect(subject).not_to receive(:process_git_repository)
|
@@ -167,10 +167,10 @@ describe GitHelper::ChangeRemote do
|
|
167
167
|
end
|
168
168
|
end
|
169
169
|
|
170
|
-
describe '#
|
171
|
-
it 'should create a new
|
172
|
-
expect(
|
173
|
-
subject.send(:
|
170
|
+
describe '#highline' do
|
171
|
+
it 'should create a new highline_wrapper instance' do
|
172
|
+
expect(HighlineWrapper).to receive(:new)
|
173
|
+
subject.send(:highline)
|
174
174
|
end
|
175
175
|
end
|
176
176
|
end
|
@@ -4,7 +4,7 @@ require 'spec_helper'
|
|
4
4
|
require 'git_helper'
|
5
5
|
|
6
6
|
describe GitHelper::CodeRequest do
|
7
|
-
let(:
|
7
|
+
let(:highline_wrapper) { double(:highline_wrapper) }
|
8
8
|
let(:local_code) { double(:local_code, project_name: Faker::Lorem.word, branch: Faker::Lorem.word) }
|
9
9
|
let(:process_project) { double(:process_project, create: :created, merge: :merged) }
|
10
10
|
let(:base_branch) { Faker::Lorem.word }
|
@@ -14,7 +14,7 @@ describe GitHelper::CodeRequest do
|
|
14
14
|
|
15
15
|
before do
|
16
16
|
allow(GitHelper::LocalCode).to receive(:new).and_return(local_code)
|
17
|
-
allow(
|
17
|
+
allow(HighlineWrapper).to receive(:new).and_return(highline_wrapper)
|
18
18
|
allow(subject).to receive(:puts)
|
19
19
|
end
|
20
20
|
|
@@ -103,19 +103,19 @@ describe GitHelper::CodeRequest do
|
|
103
103
|
|
104
104
|
describe '#ask_for_clarification' do
|
105
105
|
it 'should ask the CLI' do
|
106
|
-
expect(
|
106
|
+
expect(highline_wrapper).to receive(:ask).and_return('github')
|
107
107
|
subject.send(:ask_for_clarification)
|
108
108
|
end
|
109
109
|
|
110
110
|
context 'when response is github' do
|
111
111
|
it 'should return github_pull_request' do
|
112
|
-
allow(
|
112
|
+
allow(highline_wrapper).to receive(:ask).and_return('github')
|
113
113
|
expect(subject).to receive(:github_pull_request)
|
114
114
|
subject.send(:ask_for_clarification)
|
115
115
|
end
|
116
116
|
|
117
117
|
it 'should return github_pull_request' do
|
118
|
-
allow(
|
118
|
+
allow(highline_wrapper).to receive(:ask).and_return('Github')
|
119
119
|
expect(subject).to receive(:github_pull_request)
|
120
120
|
subject.send(:ask_for_clarification)
|
121
121
|
end
|
@@ -123,13 +123,13 @@ describe GitHelper::CodeRequest do
|
|
123
123
|
|
124
124
|
context 'when response is gitlab' do
|
125
125
|
it 'should return gitlab_merge_request' do
|
126
|
-
allow(
|
126
|
+
allow(highline_wrapper).to receive(:ask).and_return('gitlab')
|
127
127
|
expect(subject).to receive(:gitlab_merge_request)
|
128
128
|
subject.send(:ask_for_clarification)
|
129
129
|
end
|
130
130
|
|
131
131
|
it 'should return gitlab_merge_request' do
|
132
|
-
allow(
|
132
|
+
allow(highline_wrapper).to receive(:ask).and_return('Gitlab')
|
133
133
|
expect(subject).to receive(:gitlab_merge_request)
|
134
134
|
subject.send(:ask_for_clarification)
|
135
135
|
end
|
@@ -138,7 +138,7 @@ describe GitHelper::CodeRequest do
|
|
138
138
|
# Unfortunately this test sometimes fails... just rerun the tests if it does
|
139
139
|
context 'when response is neither' do
|
140
140
|
it 'should raise an error' do
|
141
|
-
allow(
|
141
|
+
allow(highline_wrapper).to receive(:ask).and_return(Faker::Lorem.word)
|
142
142
|
expect(subject).to receive(:exit)
|
143
143
|
subject.send(:ask_for_clarification)
|
144
144
|
end
|
@@ -176,23 +176,23 @@ describe GitHelper::CodeRequest do
|
|
176
176
|
describe '#base_branch' do
|
177
177
|
it 'should call the default branch' do
|
178
178
|
expect(subject).to receive(:default_branch)
|
179
|
-
allow(
|
180
|
-
allow(
|
179
|
+
allow(highline_wrapper).to receive(:ask_yes_no).at_least(:once)
|
180
|
+
allow(highline_wrapper).to receive(:ask).at_least(:once).and_return(base_branch)
|
181
181
|
subject.send(:base_branch)
|
182
182
|
end
|
183
183
|
|
184
184
|
it 'should ask the CLI to ask the user' do
|
185
185
|
allow(subject).to receive(:default_branch)
|
186
|
-
expect(
|
187
|
-
allow(
|
186
|
+
expect(highline_wrapper).to receive(:ask_yes_no).at_least(:once)
|
187
|
+
allow(highline_wrapper).to receive(:ask).at_least(:once).and_return(base_branch)
|
188
188
|
subject.send(:base_branch)
|
189
189
|
end
|
190
190
|
|
191
191
|
context 'if the user says no' do
|
192
192
|
it 'definitely asks for the users base branch' do
|
193
193
|
allow(subject).to receive(:default_branch)
|
194
|
-
expect(
|
195
|
-
expect(
|
194
|
+
expect(highline_wrapper).to receive(:ask_yes_no).at_least(:once).and_return(false)
|
195
|
+
expect(highline_wrapper).to receive(:ask).at_least(:once).and_return(base_branch)
|
196
196
|
subject.send(:base_branch)
|
197
197
|
end
|
198
198
|
end
|
@@ -200,8 +200,8 @@ describe GitHelper::CodeRequest do
|
|
200
200
|
context 'if the user says yes' do
|
201
201
|
it 'does not ask for the users base branch' do
|
202
202
|
allow(subject).to receive(:default_branch)
|
203
|
-
expect(
|
204
|
-
expect(
|
203
|
+
expect(highline_wrapper).to receive(:ask_yes_no).at_least(:once).and_return(true)
|
204
|
+
expect(highline_wrapper).not_to receive(:base_branch)
|
205
205
|
subject.send(:base_branch)
|
206
206
|
end
|
207
207
|
end
|
@@ -218,23 +218,23 @@ describe GitHelper::CodeRequest do
|
|
218
218
|
describe '#new_code_request_title' do
|
219
219
|
it 'should call autogenerated title method' do
|
220
220
|
expect(subject).to receive(:autogenerated_title)
|
221
|
-
allow(
|
222
|
-
allow(
|
221
|
+
allow(highline_wrapper).to receive(:ask_yes_no).at_least(:once)
|
222
|
+
allow(highline_wrapper).to receive(:ask).at_least(:once).and_return(title)
|
223
223
|
subject.send(:new_code_request_title)
|
224
224
|
end
|
225
225
|
|
226
226
|
it 'should ask the CLI to ask the user' do
|
227
227
|
allow(subject).to receive(:autogenerated_title).and_return(Faker::Lorem.sentence)
|
228
|
-
expect(
|
229
|
-
allow(
|
228
|
+
expect(highline_wrapper).to receive(:ask_yes_no).at_least(:once)
|
229
|
+
allow(highline_wrapper).to receive(:ask).at_least(:once).and_return(title)
|
230
230
|
subject.send(:new_code_request_title)
|
231
231
|
end
|
232
232
|
|
233
233
|
context 'if the user says no' do
|
234
234
|
it 'definitely asks for the users title' do
|
235
235
|
allow(subject).to receive(:autogenerated_title).and_return(Faker::Lorem.sentence)
|
236
|
-
expect(
|
237
|
-
expect(
|
236
|
+
expect(highline_wrapper).to receive(:ask_yes_no).at_least(:once).and_return(false)
|
237
|
+
expect(highline_wrapper).to receive(:ask).at_least(:once).and_return(title)
|
238
238
|
subject.send(:new_code_request_title)
|
239
239
|
end
|
240
240
|
end
|
@@ -242,8 +242,8 @@ describe GitHelper::CodeRequest do
|
|
242
242
|
context 'if the user says yes to original title' do
|
243
243
|
it 'does not ask for the users chosen title' do
|
244
244
|
allow(subject).to receive(:autogenerated_title).and_return(Faker::Lorem.sentence)
|
245
|
-
expect(
|
246
|
-
expect(
|
245
|
+
expect(highline_wrapper).to receive(:ask_yes_no).at_least(:once).and_return(true)
|
246
|
+
expect(highline_wrapper).not_to receive(:ask)
|
247
247
|
subject.send(:new_code_request_title)
|
248
248
|
end
|
249
249
|
end
|
@@ -256,10 +256,10 @@ describe GitHelper::CodeRequest do
|
|
256
256
|
end
|
257
257
|
end
|
258
258
|
|
259
|
-
describe '#
|
260
|
-
it 'should
|
261
|
-
expect(
|
262
|
-
subject.send(:
|
259
|
+
describe '#highline' do
|
260
|
+
it 'should create a highline_wrapper client' do
|
261
|
+
expect(HighlineWrapper).to receive(:new).and_return(highline_wrapper)
|
262
|
+
subject.send(:highline)
|
263
263
|
end
|
264
264
|
end
|
265
265
|
end
|
@@ -5,7 +5,7 @@ require 'git_helper'
|
|
5
5
|
|
6
6
|
describe GitHelper::GitLabMergeRequest do
|
7
7
|
let(:local_code) { double(:local_code, read_template: Faker::Lorem.word) }
|
8
|
-
let(:
|
8
|
+
let(:highline_wrapper) { double(:highline_wrapper) }
|
9
9
|
let(:gitlab_client_client) { double(:gitlab_client_client, project: :project, merge_request: :merge_request, create_merge_request: :created) }
|
10
10
|
let(:gitlab_client) { double(:gitlab_client, client: gitlab_client_client) }
|
11
11
|
let(:diff_refs) { double(:diff_refs, base_sha: :base, head_sha: :head) }
|
@@ -22,7 +22,7 @@ describe GitHelper::GitLabMergeRequest do
|
|
22
22
|
local_project: Faker::Lorem.word,
|
23
23
|
local_branch: Faker::Lorem.word,
|
24
24
|
local_code: local_code,
|
25
|
-
|
25
|
+
highline: highline_wrapper
|
26
26
|
}
|
27
27
|
end
|
28
28
|
|
@@ -121,19 +121,19 @@ describe GitHelper::GitLabMergeRequest do
|
|
121
121
|
|
122
122
|
it 'should call the CLI to ask about a single template' do
|
123
123
|
allow(subject).to receive(:mr_template_options).and_return([template])
|
124
|
-
expect(
|
124
|
+
expect(highline_wrapper).to receive(:ask_yes_no).and_return(true)
|
125
125
|
subject.send(:template_name_to_apply)
|
126
126
|
end
|
127
127
|
|
128
128
|
it 'should return the single template if the user says yes' do
|
129
129
|
allow(subject).to receive(:mr_template_options).and_return([template])
|
130
|
-
allow(
|
130
|
+
allow(highline_wrapper).to receive(:ask_yes_no).and_return(true)
|
131
131
|
expect(subject.send(:template_name_to_apply)).to eq(template)
|
132
132
|
end
|
133
133
|
|
134
134
|
it 'should return nil if the user says no' do
|
135
135
|
allow(subject).to receive(:mr_template_options).and_return([template])
|
136
|
-
allow(
|
136
|
+
allow(highline_wrapper).to receive(:ask_yes_no).and_return(false)
|
137
137
|
expect(subject.send(:template_name_to_apply)).to eq(nil)
|
138
138
|
end
|
139
139
|
end
|
@@ -144,19 +144,19 @@ describe GitHelper::GitLabMergeRequest do
|
|
144
144
|
|
145
145
|
it 'should call the CLI to ask which of multiple templates to apply' do
|
146
146
|
allow(subject).to receive(:mr_template_options).and_return([template1, template2])
|
147
|
-
expect(
|
147
|
+
expect(highline_wrapper).to receive(:ask_options).and_return(template1)
|
148
148
|
subject.send(:template_name_to_apply)
|
149
149
|
end
|
150
150
|
|
151
151
|
it 'should return the answer template if the user says yes' do
|
152
152
|
allow(subject).to receive(:mr_template_options).and_return([template1, template2])
|
153
|
-
allow(
|
153
|
+
allow(highline_wrapper).to receive(:ask_options).and_return(template1)
|
154
154
|
expect(subject.send(:template_name_to_apply)).to eq(template1)
|
155
155
|
end
|
156
156
|
|
157
157
|
it 'should return nil if the user says no' do
|
158
158
|
allow(subject).to receive(:mr_template_options).and_return([template1, template2])
|
159
|
-
allow(
|
159
|
+
allow(highline_wrapper).to receive(:ask_options).and_return('None')
|
160
160
|
expect(subject.send(:template_name_to_apply)).to eq(nil)
|
161
161
|
end
|
162
162
|
end
|
@@ -171,25 +171,25 @@ describe GitHelper::GitLabMergeRequest do
|
|
171
171
|
|
172
172
|
describe '#mr_id' do
|
173
173
|
it 'should ask the CLI for the code request ID' do
|
174
|
-
expect(
|
174
|
+
expect(highline_wrapper).to receive(:ask).and_return(Faker::Number.number)
|
175
175
|
subject.send(:mr_id)
|
176
176
|
end
|
177
177
|
|
178
178
|
it 'should equal an integer' do
|
179
179
|
pr_id = Faker::Number.number
|
180
|
-
expect(
|
180
|
+
expect(highline_wrapper).to receive(:ask).and_return(pr_id)
|
181
181
|
expect(subject.send(:mr_id)).to eq(pr_id)
|
182
182
|
end
|
183
183
|
end
|
184
184
|
|
185
185
|
describe '#squash_merge_request' do
|
186
186
|
it 'should ask the CLI for the code request ID' do
|
187
|
-
expect(
|
187
|
+
expect(highline_wrapper).to receive(:ask_yes_no).and_return(true)
|
188
188
|
subject.send(:squash_merge_request)
|
189
189
|
end
|
190
190
|
|
191
191
|
it 'should be a boolean' do
|
192
|
-
expect(
|
192
|
+
expect(highline_wrapper).to receive(:ask_yes_no).and_return(false)
|
193
193
|
expect([true, false]).to include(subject.send(:squash_merge_request))
|
194
194
|
end
|
195
195
|
end
|
@@ -201,12 +201,12 @@ describe GitHelper::GitLabMergeRequest do
|
|
201
201
|
|
202
202
|
context 'when the existing project has no setting' do
|
203
203
|
it 'should ask the CLI for the code request ID' do
|
204
|
-
expect(
|
204
|
+
expect(highline_wrapper).to receive(:ask_yes_no).and_return(true)
|
205
205
|
subject.send(:remove_source_branch)
|
206
206
|
end
|
207
207
|
|
208
208
|
it 'should be a boolean' do
|
209
|
-
allow(
|
209
|
+
allow(highline_wrapper).to receive(:ask_yes_no).and_return(false)
|
210
210
|
expect([true, false]).to include(subject.send(:remove_source_branch))
|
211
211
|
end
|
212
212
|
end
|
@@ -223,7 +223,7 @@ describe GitHelper::GitLabMergeRequest do
|
|
223
223
|
|
224
224
|
it 'should return the existing projects setting if it exists' do
|
225
225
|
allow(subject).to receive(:existing_project).and_return(double(remove_source_branch_after_merge: false))
|
226
|
-
allow(
|
226
|
+
allow(highline_wrapper).to receive(:ask_yes_no).and_return(true)
|
227
227
|
expect(subject.send(:remove_source_branch)).to eq(true)
|
228
228
|
end
|
229
229
|
end
|
@@ -237,7 +237,7 @@ describe GitHelper::GitLabMergeRequest do
|
|
237
237
|
|
238
238
|
describe '#existing_mr' do
|
239
239
|
it 'should call the gitlab client' do
|
240
|
-
allow(
|
240
|
+
allow(highline_wrapper).to receive(:ask).and_return(Faker::Number.number)
|
241
241
|
expect(gitlab_client_client).to receive(:merge_request).and_return(:merge_request)
|
242
242
|
subject.send(:existing_mr)
|
243
243
|
end
|
@@ -6,13 +6,13 @@ require 'git_helper'
|
|
6
6
|
describe GitHelper::NewBranch do
|
7
7
|
let(:new_branch_name) { 'new-branch-name' }
|
8
8
|
let(:local_code) { double(:local_code, new_branch: :commit) }
|
9
|
-
let(:
|
9
|
+
let(:highline) { double(:highline_wrapper, ask: new_branch_name) }
|
10
10
|
|
11
11
|
subject { GitHelper::NewBranch.new }
|
12
12
|
|
13
13
|
before do
|
14
14
|
allow(GitHelper::LocalCode).to receive(:new).and_return(local_code)
|
15
|
-
allow(
|
15
|
+
allow(HighlineWrapper).to receive(:new).and_return(highline)
|
16
16
|
allow(subject).to receive(:puts)
|
17
17
|
end
|
18
18
|
|
@@ -27,20 +27,20 @@ describe GitHelper::NewBranch do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
context 'when no branch name is passed in' do
|
30
|
-
it 'should call the highline
|
31
|
-
expect(
|
30
|
+
it 'should call the highline client' do
|
31
|
+
expect(HighlineWrapper).to receive(:new).and_return(highline)
|
32
32
|
subject.execute
|
33
33
|
end
|
34
34
|
|
35
|
-
it 'should ask the highline
|
36
|
-
expect(
|
35
|
+
it 'should ask the highline client what the new branch name should be' do
|
36
|
+
expect(highline).to receive(:ask)
|
37
37
|
subject.execute
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
context 'when there is a branch name passed in' do
|
42
|
-
it 'should not create a
|
43
|
-
expect(
|
42
|
+
it 'should not create a highline_wrapper client' do
|
43
|
+
expect(HighlineWrapper).not_to receive(:new)
|
44
44
|
subject.execute(new_branch_name)
|
45
45
|
end
|
46
46
|
end
|
@@ -5,7 +5,7 @@ require 'git_helper'
|
|
5
5
|
|
6
6
|
describe GitHelper::GitHubPullRequest do
|
7
7
|
let(:local_code) { double(:local_code, read_template: Faker::Lorem.word) }
|
8
|
-
let(:
|
8
|
+
let(:highline_wrapper) { double(:highline_wrapper) }
|
9
9
|
let(:octokit_client_client) { double(:octokit_client_client, project: :project, merge_request: :merge_request, create_merge_request: :created) }
|
10
10
|
let(:octokit_client) { double(:octokit_client, client: octokit_client_client) }
|
11
11
|
|
@@ -14,7 +14,7 @@ describe GitHelper::GitHubPullRequest do
|
|
14
14
|
local_project: Faker::Lorem.word,
|
15
15
|
local_branch: Faker::Lorem.word,
|
16
16
|
local_code: local_code,
|
17
|
-
|
17
|
+
highline: highline_wrapper
|
18
18
|
}
|
19
19
|
end
|
20
20
|
|
@@ -103,19 +103,19 @@ describe GitHelper::GitHubPullRequest do
|
|
103
103
|
|
104
104
|
it 'should call the CLI to ask about a single template' do
|
105
105
|
allow(subject).to receive(:pr_template_options).and_return([template])
|
106
|
-
expect(
|
106
|
+
expect(highline_wrapper).to receive(:ask_yes_no).and_return(true)
|
107
107
|
subject.send(:template_name_to_apply)
|
108
108
|
end
|
109
109
|
|
110
110
|
it 'should return the single template if the user says yes' do
|
111
111
|
allow(subject).to receive(:pr_template_options).and_return([template])
|
112
|
-
allow(
|
112
|
+
allow(highline_wrapper).to receive(:ask_yes_no).and_return(true)
|
113
113
|
expect(subject.send(:template_name_to_apply)).to eq(template)
|
114
114
|
end
|
115
115
|
|
116
116
|
it 'should return nil if the user says no' do
|
117
117
|
allow(subject).to receive(:pr_template_options).and_return([template])
|
118
|
-
allow(
|
118
|
+
allow(highline_wrapper).to receive(:ask_yes_no).and_return(false)
|
119
119
|
expect(subject.send(:template_name_to_apply)).to eq(nil)
|
120
120
|
end
|
121
121
|
end
|
@@ -126,19 +126,19 @@ describe GitHelper::GitHubPullRequest do
|
|
126
126
|
|
127
127
|
it 'should call the CLI to ask which of multiple templates to apply' do
|
128
128
|
allow(subject).to receive(:pr_template_options).and_return([template1, template2])
|
129
|
-
expect(
|
129
|
+
expect(highline_wrapper).to receive(:ask_options).and_return(template1)
|
130
130
|
subject.send(:template_name_to_apply)
|
131
131
|
end
|
132
132
|
|
133
133
|
it 'should return the answer template if the user says yes' do
|
134
134
|
allow(subject).to receive(:pr_template_options).and_return([template1, template2])
|
135
|
-
allow(
|
135
|
+
allow(highline_wrapper).to receive(:ask_options).and_return(template1)
|
136
136
|
expect(subject.send(:template_name_to_apply)).to eq(template1)
|
137
137
|
end
|
138
138
|
|
139
139
|
it 'should return nil if the user says no' do
|
140
140
|
allow(subject).to receive(:pr_template_options).and_return([template1, template2])
|
141
|
-
allow(
|
141
|
+
allow(highline_wrapper).to receive(:ask_options).and_return('None')
|
142
142
|
expect(subject.send(:template_name_to_apply)).to eq(nil)
|
143
143
|
end
|
144
144
|
end
|
@@ -153,13 +153,13 @@ describe GitHelper::GitHubPullRequest do
|
|
153
153
|
|
154
154
|
describe '#pr_id' do
|
155
155
|
it 'should ask the CLI for the code request ID' do
|
156
|
-
expect(
|
156
|
+
expect(highline_wrapper).to receive(:ask).and_return(Faker::Number.number)
|
157
157
|
subject.send(:pr_id)
|
158
158
|
end
|
159
159
|
|
160
160
|
it 'should equal an integer' do
|
161
161
|
pr_id = Faker::Number.number
|
162
|
-
expect(
|
162
|
+
expect(highline_wrapper).to receive(:ask).and_return(pr_id)
|
163
163
|
expect(subject.send(:pr_id)).to eq(pr_id)
|
164
164
|
end
|
165
165
|
end
|
@@ -169,16 +169,16 @@ describe GitHelper::GitHubPullRequest do
|
|
169
169
|
|
170
170
|
before do
|
171
171
|
allow(subject).to receive(:existing_project).and_return(project)
|
172
|
-
allow(
|
172
|
+
allow(highline_wrapper).to receive(:ask_options)
|
173
173
|
end
|
174
174
|
|
175
175
|
it 'should ask the CLI for the merge_method' do
|
176
|
-
expect(
|
176
|
+
expect(highline_wrapper).to receive(:ask_options).and_return('merge')
|
177
177
|
subject.send(:merge_method)
|
178
178
|
end
|
179
179
|
|
180
180
|
it 'should be a string' do
|
181
|
-
allow(
|
181
|
+
allow(highline_wrapper).to receive(:ask_options).and_return('merge')
|
182
182
|
expect(subject.send(:merge_method)).to be_a(String)
|
183
183
|
end
|
184
184
|
|
@@ -186,7 +186,7 @@ describe GitHelper::GitHubPullRequest do
|
|
186
186
|
let(:project) { double(:project, allow_merge_commit: true, allow_squash_merge: false, allow_rebase_merge: false) }
|
187
187
|
|
188
188
|
it 'should not ask the CLI anything' do
|
189
|
-
expect(
|
189
|
+
expect(highline_wrapper).not_to receive(:merge_method)
|
190
190
|
subject.send(:merge_method)
|
191
191
|
end
|
192
192
|
end
|
@@ -241,7 +241,7 @@ describe GitHelper::GitHubPullRequest do
|
|
241
241
|
|
242
242
|
describe '#existing_pr' do
|
243
243
|
it 'should call the octokit client' do
|
244
|
-
allow(
|
244
|
+
allow(highline_wrapper).to receive(:ask).and_return(Faker::Number.number)
|
245
245
|
expect(octokit_client_client).to receive(:pull_request).and_return(:pull_request)
|
246
246
|
subject.send(:existing_pr)
|
247
247
|
end
|