git_helper 3.3.0 → 3.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/Gemfile.lock +58 -64
  4. data/Guardfile +5 -3
  5. data/LICENSE.md +29 -0
  6. data/README.md +42 -34
  7. data/Rakefile +2 -0
  8. data/bin/git-helper +18 -13
  9. data/lib/git_helper/change_remote.rb +15 -6
  10. data/lib/git_helper/checkout_default.rb +2 -0
  11. data/lib/git_helper/clean_branches.rb +2 -0
  12. data/lib/git_helper/code_request.rb +33 -19
  13. data/lib/git_helper/empty_commit.rb +2 -0
  14. data/lib/git_helper/forget_local_commits.rb +2 -0
  15. data/lib/git_helper/git_config_reader.rb +11 -5
  16. data/lib/git_helper/github_client.rb +70 -0
  17. data/lib/git_helper/gitlab_client.rb +48 -2
  18. data/lib/git_helper/local_code.rb +24 -14
  19. data/lib/git_helper/merge_request.rb +98 -70
  20. data/lib/git_helper/new_branch.rb +3 -1
  21. data/lib/git_helper/pull_request.rb +91 -73
  22. data/lib/git_helper/setup.rb +62 -39
  23. data/lib/git_helper/version.rb +3 -1
  24. data/lib/git_helper.rb +7 -4
  25. data/renovate.json +6 -0
  26. metadata +34 -80
  27. data/LICENSE +0 -22
  28. data/lib/git_helper/highline_cli.rb +0 -33
  29. data/lib/git_helper/octokit_client.rb +0 -11
  30. data/plugins.zip +0 -0
  31. data/spec/git_helper/change_remote_spec.rb +0 -176
  32. data/spec/git_helper/checkout_default_spec.rb +0 -19
  33. data/spec/git_helper/clean_branches_spec.rb +0 -19
  34. data/spec/git_helper/code_request_spec.rb +0 -263
  35. data/spec/git_helper/empty_commit_spec.rb +0 -19
  36. data/spec/git_helper/forget_local_commits_spec.rb +0 -19
  37. data/spec/git_helper/git_config_reader_spec.rb +0 -62
  38. data/spec/git_helper/gitlab_client_spec.rb +0 -26
  39. data/spec/git_helper/highline_cli_spec.rb +0 -51
  40. data/spec/git_helper/local_code_spec.rb +0 -268
  41. data/spec/git_helper/merge_request_spec.rb +0 -251
  42. data/spec/git_helper/new_branch_spec.rb +0 -45
  43. data/spec/git_helper/octokit_client_spec.rb +0 -26
  44. data/spec/git_helper/pull_request_spec.rb +0 -254
  45. data/spec/git_helper/setup_spec.rb +0 -170
  46. data/spec/spec_helper.rb +0 -47
@@ -1,268 +0,0 @@
1
- require 'spec_helper'
2
- require 'git_helper'
3
-
4
- describe GitHelper::LocalCode do
5
- let(:response) { double(:response, readline: true, to_i: 5) }
6
- let(:local_codeent) { double(:local_code, ask: response) }
7
- let(:project_name) { Faker::Lorem.word }
8
- let(:owner) { Faker::Name.first_name }
9
- let(:ssh_remote) { "origin\tgit@github.com:#{owner}/#{project_name}.git (fetch)" }
10
- let(:https_remote) { "origin\thttps://github.com/#{owner}/#{project_name}.git (fetch)" }
11
-
12
- let(:github_remotes) do
13
- [
14
- "origin\tgit@github.com:#{owner}/#{project_name}.git (fetch)",
15
- "origin\thttps://github.com/#{owner}/#{project_name}.git (fetch)"
16
- ]
17
- end
18
-
19
- let(:gitlab_remotes) do
20
- [
21
- "origin\tgit@gitlab.com:#{owner}/#{project_name}.git (fetch)",
22
- "origin\thttps://gitlab.com/#{owner}/#{project_name}.git (fetch)"
23
- ]
24
- end
25
-
26
- subject { GitHelper::LocalCode.new }
27
-
28
- before do
29
- allow(subject).to receive(:system).and_return(nil)
30
- end
31
-
32
- describe '#checkout_default' do
33
- it 'should make a system call' do
34
- expect(subject).to receive(:system)
35
- subject.checkout_default
36
- end
37
- end
38
-
39
- describe '#forget_local_commits' do
40
- it 'should make a system call' do
41
- expect(subject).to receive(:system).exactly(2).times
42
- subject.forget_local_commits
43
- end
44
-
45
- it 'should return nil' do
46
- expect(subject.forget_local_commits).to eq(nil)
47
- end
48
- end
49
-
50
- describe '#empty_commit' do
51
- it 'should make a system call' do
52
- expect(subject).to receive(:system)
53
- subject.empty_commit
54
- end
55
- end
56
-
57
- describe '#clean_branches' do
58
- it 'should make a system call' do
59
- expect(subject).to receive(:system).exactly(4).times
60
- subject.clean_branches
61
- end
62
- end
63
-
64
- describe '#new_branch' do
65
- it 'should make a system call' do
66
- expect(subject).to receive(:system).exactly(4).times
67
- subject.new_branch(Faker::Lorem.word)
68
- end
69
- end
70
-
71
- describe '#change_remote' do
72
- it 'should return a string' do
73
- allow(subject).to receive(:`).and_return(Faker::Lorem.word)
74
- expect(subject.change_remote(Faker::Lorem.word, Faker::Internet.url)).to be_a(String)
75
- end
76
- end
77
-
78
- describe '#remotes' do
79
- it 'should return an array of strings' do
80
- expect(subject.remotes).to be_a(Array)
81
- expect(subject.remotes.first).to be_a(String)
82
- end
83
- end
84
-
85
- describe '#remote_name' do
86
- it 'should be a string' do
87
- expect(subject.remote_name(ssh_remote)).to be_a(String)
88
- end
89
- end
90
-
91
- describe '#ssh_remote' do
92
- it 'should come out true if ssh' do
93
- expect(subject.ssh_remote?(ssh_remote)).to eq(true)
94
- end
95
-
96
- it 'should come out false if https' do
97
- expect(subject.ssh_remote?(https_remote)).to eq(false)
98
- end
99
- end
100
-
101
- describe '#https_remote' do
102
- it 'should come out false if ssh' do
103
- expect(subject.https_remote?(ssh_remote)).to eq(false)
104
- end
105
-
106
- it 'should come out true if https' do
107
- expect(subject.https_remote?(https_remote)).to eq(true)
108
- end
109
- end
110
-
111
- describe '#remote_project' do
112
- it 'should return just the plain project if ssh' do
113
- expect(subject.remote_project(ssh_remote)).to eq(project_name)
114
- end
115
-
116
- it 'should return just the plain project if https' do
117
- expect(subject.remote_project(https_remote)).to eq(project_name)
118
- end
119
- end
120
-
121
- describe '#remote_source' do
122
- it 'should return just the plain project if ssh' do
123
- expect(subject.remote_source(ssh_remote)).to eq('github.com')
124
- end
125
-
126
- it 'should return just the plain project if https' do
127
- expect(subject.remote_source(https_remote)).to eq('github.com')
128
- end
129
- end
130
-
131
- describe '#github_repo' do
132
- it 'should return true if github' do
133
- allow(subject).to receive(:remotes).and_return(github_remotes)
134
- expect(subject.github_repo?).to eq(true)
135
- end
136
-
137
- it 'should return false if gitlab' do
138
- allow(subject).to receive(:remotes).and_return(gitlab_remotes)
139
- expect(subject.github_repo?).to eq(false)
140
- end
141
- end
142
-
143
- describe '#gitlab_project' do
144
- it 'should return true if gitlab' do
145
- allow(subject).to receive(:remotes).and_return(gitlab_remotes)
146
- expect(subject.gitlab_project?).to eq(true)
147
- end
148
-
149
- it 'should return false if github' do
150
- allow(subject).to receive(:remotes).and_return(github_remotes)
151
- expect(subject.gitlab_project?).to eq(false)
152
- end
153
- end
154
-
155
- describe '#project_name' do
156
- it 'should return a string' do
157
- expect(subject.project_name).to be_a(String)
158
- end
159
-
160
- it 'should equal this project name' do
161
- allow_any_instance_of(String).to receive(:scan).and_return([["#{owner}/#{project_name}"]])
162
- expect(subject.project_name).to eq("#{owner}/#{project_name}")
163
- end
164
- end
165
-
166
- describe '#branch' do
167
- it 'should return a string' do
168
- expect(subject.branch).to be_a(String)
169
- end
170
- end
171
-
172
- describe '#default_branch' do
173
- it 'should return a string' do
174
- expect(subject.default_branch).to be_a(String)
175
- end
176
- end
177
-
178
- describe '#template_options' do
179
- let(:template_identifiers) do
180
- {
181
- template_directory: '.github',
182
- nested_directory_name: 'PULL_REQUEST_TEMPLATE',
183
- non_nested_file_name: 'pull_request_template'
184
- }
185
- end
186
-
187
- it 'should return an array' do
188
- expect(subject.template_options(template_identifiers)).to be_a(Array)
189
- end
190
-
191
- it 'should call Dir.glob and File.join' do
192
- expect(Dir).to receive(:glob).and_return(['.github/pull_request_template.md']).at_least(:once)
193
- expect(File).to receive(:join).at_least(:once)
194
- subject.template_options(template_identifiers)
195
- end
196
- end
197
-
198
- describe '#read_template' do
199
- it 'should call File.open' do
200
- expect(File).to receive(:open).and_return(double(read: true))
201
- subject.read_template('.gitignore')
202
- end
203
- end
204
-
205
- describe '#generate_title' do
206
- it 'should return a title based on the branch' do
207
- prefix = Faker::Lorem.word
208
- word1 = Faker::Lorem.word
209
- word2 = Faker::Lorem.word
210
- description = [word1, word2].join('-')
211
- branch = "#{prefix}-123-#{description}"
212
- expect(subject.generate_title(branch)).to eq("#{prefix.upcase}-123 #{[word1.capitalize, word2].join(' ')}")
213
- end
214
-
215
- it 'should return a title based on the branch' do
216
- prefix = Faker::Lorem.word
217
- word1 = Faker::Lorem.word
218
- word2 = Faker::Lorem.word
219
- description = [word1, word2].join('_')
220
- branch = "#{prefix}_123_#{description}"
221
- expect(subject.generate_title(branch)).to eq("#{prefix.upcase}-123 #{[word1.capitalize, word2].join(' ')}")
222
- end
223
-
224
- it 'should return a title based on the branch' do
225
- prefix = Faker::Lorem.word
226
- word1 = Faker::Lorem.word
227
- word2 = Faker::Lorem.word
228
- description = [word1, word2].join('_')
229
- branch = "#{prefix}-123_#{description}"
230
- expect(subject.generate_title(branch)).to eq("#{prefix.upcase}-123 #{[word1.capitalize, word2].join(' ')}")
231
- end
232
-
233
- it 'should return a title based on the branch' do
234
- word1 = Faker::Lorem.word
235
- word2 = Faker::Lorem.word
236
- branch = [word1, word2].join('_')
237
- expect(subject.generate_title(branch)).to eq([word1.capitalize, word2].join(' '))
238
- end
239
-
240
- it 'should return a title based on the branch' do
241
- word1 = Faker::Lorem.word
242
- word2 = Faker::Lorem.word
243
- branch = [word1, word2].join('-')
244
- expect(subject.generate_title(branch)).to eq([word1.capitalize, word2].join(' '))
245
- end
246
-
247
- it 'should return a title based on the branch' do
248
- branch = Faker::Lorem.word
249
- expect(subject.generate_title(branch)).to eq(branch.capitalize)
250
- end
251
-
252
- it 'should return a title based on the branch' do
253
- word1 = Faker::Lorem.word
254
- word2 = Faker::Lorem.word
255
- word3 = Faker::Lorem.word
256
- branch = [word1, word2, word3].join('_')
257
- expect(subject.generate_title(branch)).to eq([word1.capitalize, word2, word3].join(' '))
258
- end
259
-
260
- it 'should return a title based on the branch' do
261
- word1 = Faker::Lorem.word
262
- word2 = Faker::Lorem.word
263
- word3 = Faker::Lorem.word
264
- branch = [word1, word2, word3].join('-')
265
- expect(subject.generate_title(branch)).to eq([word1.capitalize, word2, word3].join(' '))
266
- end
267
- end
268
- end
@@ -1,251 +0,0 @@
1
- require 'spec_helper'
2
- require 'git_helper'
3
-
4
- describe GitHelper::GitLabMergeRequest do
5
- let(:local_code) { double(:local_code, read_template: Faker::Lorem.word) }
6
- let(:highline_cli) { double(:highline_cli) }
7
- let(:gitlab_client_client) { double(:gitlab_client_client, project: :project, merge_request: :merge_request, create_merge_request: :created) }
8
- let(:gitlab_client) { double(:gitlab_client, client: gitlab_client_client) }
9
- let(:diff_refs) { double(:diff_refs, base_sha: :base, head_sha: :head) }
10
-
11
- let(:merge_request) do
12
- double(:merge_request,
13
- diff_refs: diff_refs,
14
- web_url: Faker::Internet.url,
15
- merge_commit_sha: Faker::Internet.password
16
- )
17
- end
18
-
19
- let(:options) do
20
- {
21
- local_project: Faker::Lorem.word,
22
- local_branch: Faker::Lorem.word,
23
- local_code: local_code,
24
- cli: highline_cli
25
- }
26
- end
27
-
28
- subject { described_class.new(options) }
29
-
30
- before do
31
- allow(GitHelper::GitLabClient).to receive(:new).and_return(gitlab_client)
32
- allow(subject).to receive(:puts)
33
- end
34
-
35
- describe '#create' do
36
- it 'should call the gitlab client to create' do
37
- allow(subject).to receive(:squash_merge_request).and_return(true)
38
- allow(subject).to receive(:remove_source_branch).and_return(false)
39
- allow(subject).to receive(:new_mr_body).and_return('')
40
- expect(gitlab_client_client).to receive(:create_merge_request).and_return(merge_request)
41
- subject.create({base_branch: Faker::Lorem.word, new_title: Faker::Lorem.word})
42
- end
43
-
44
- it 'should call various other methods' do
45
- expect(subject).to receive(:squash_merge_request).and_return(true)
46
- expect(subject).to receive(:remove_source_branch).and_return(false)
47
- expect(subject).to receive(:new_mr_body).and_return('')
48
- allow(gitlab_client_client).to receive(:create_merge_request).and_return(merge_request)
49
- subject.create({base_branch: Faker::Lorem.word, new_title: Faker::Lorem.word})
50
- end
51
-
52
- it 'should catch the raised error if the creation does not work' do
53
- allow(subject).to receive(:squash_merge_request).and_return(true)
54
- allow(subject).to receive(:remove_source_branch).and_return(false)
55
- allow(subject).to receive(:new_mr_body).and_return('')
56
- allow(gitlab_client_client).to receive(:create_merge_request).and_raise(StandardError)
57
- expect(subject.create({base_branch: Faker::Lorem.word, new_title: Faker::Lorem.word})).to eq(nil)
58
- end
59
- end
60
-
61
- describe '#merge' do
62
- it 'should call the gitlab client to merge' do
63
- allow(subject).to receive(:existing_mr).and_return(double(should_remove_source_branch: true, squash: false, title: 'title'))
64
- allow(subject).to receive(:mr_id).and_return(Faker::Number.number)
65
- expect(gitlab_client_client).to receive(:accept_merge_request).and_return(merge_request)
66
- subject.merge
67
- end
68
-
69
- it 'should call various other methods' do
70
- expect(subject).to receive(:existing_mr).and_return(double(should_remove_source_branch: true, squash: false, title: 'title')).at_least(:once)
71
- expect(subject).to receive(:mr_id).and_return(Faker::Number.number).at_least(:once)
72
- allow(gitlab_client_client).to receive(:accept_merge_request).and_return(merge_request)
73
- subject.merge
74
- end
75
-
76
- it 'should catch the raised error if the merge does not work' do
77
- allow(subject).to receive(:existing_mr).and_return(double(should_remove_source_branch: true, squash: false, title: 'title'))
78
- allow(subject).to receive(:mr_id).and_return(Faker::Number.number)
79
- allow(gitlab_client_client).to receive(:accept_merge_request).and_raise(StandardError)
80
- expect(subject.merge).to eq(nil)
81
- end
82
-
83
- it 'should try to merge multiple times if the first merge errors' do
84
- allow(subject).to receive(:existing_mr).and_return(double(should_remove_source_branch: true, squash: false, title: 'title'))
85
- allow(subject).to receive(:mr_id).and_return(Faker::Number.number)
86
- expect(gitlab_client_client).to receive(:accept_merge_request).and_return(double(merge_commit_sha: nil, merge_error: Faker::Lorem.word)).exactly(2).times
87
- expect(subject.merge).to eq(nil)
88
- end
89
- end
90
-
91
- describe '#new_mr_body' do
92
- it 'should call the local code if the template to apply exists' do
93
- allow(subject).to receive(:template_name_to_apply).and_return('')
94
- expect(local_code).to receive(:read_template)
95
- subject.send(:new_mr_body)
96
- end
97
-
98
- it 'should not call the local code if the template is nil' do
99
- allow(subject).to receive(:template_name_to_apply).and_return(nil)
100
- expect(local_code).not_to receive(:read_template)
101
- subject.send(:new_mr_body)
102
- end
103
-
104
- it 'should return an empty string if the template is nil' do
105
- allow(subject).to receive(:template_name_to_apply).and_return(nil)
106
- expect(subject.send(:new_mr_body)).to eq('')
107
- end
108
- end
109
-
110
- describe '#template_name_to_apply' do
111
- context 'if MR template options are empty' do
112
- it 'should return nil' do
113
- allow(subject).to receive(:mr_template_options).and_return([])
114
- expect(subject.send(:template_name_to_apply)).to eq(nil)
115
- end
116
- end
117
-
118
- context 'if there is one template option' do
119
- let(:template) { Faker::Lorem.word }
120
-
121
- it 'should call the CLI to ask about a single template' do
122
- allow(subject).to receive(:mr_template_options).and_return([template])
123
- expect(highline_cli).to receive(:ask_yes_no).and_return(true)
124
- subject.send(:template_name_to_apply)
125
- end
126
-
127
- it 'should return the single template if the user says yes' do
128
- allow(subject).to receive(:mr_template_options).and_return([template])
129
- allow(highline_cli).to receive(:ask_yes_no).and_return(true)
130
- expect(subject.send(:template_name_to_apply)).to eq(template)
131
- end
132
-
133
- it 'should return nil if the user says no' do
134
- allow(subject).to receive(:mr_template_options).and_return([template])
135
- allow(highline_cli).to receive(:ask_yes_no).and_return(false)
136
- expect(subject.send(:template_name_to_apply)).to eq(nil)
137
- end
138
- end
139
-
140
- context 'if there are multiple template options' do
141
- let(:template1) { Faker::Lorem.word }
142
- let(:template2) { Faker::Lorem.word }
143
-
144
- it 'should call the CLI to ask which of multiple templates to apply' do
145
- allow(subject).to receive(:mr_template_options).and_return([template1, template2])
146
- expect(highline_cli).to receive(:ask_options).and_return(template1)
147
- subject.send(:template_name_to_apply)
148
- end
149
-
150
- it 'should return the answer template if the user says yes' do
151
- allow(subject).to receive(:mr_template_options).and_return([template1, template2])
152
- allow(highline_cli).to receive(:ask_options).and_return(template1)
153
- expect(subject.send(:template_name_to_apply)).to eq(template1)
154
- end
155
-
156
- it 'should return nil if the user says no' do
157
- allow(subject).to receive(:mr_template_options).and_return([template1, template2])
158
- allow(highline_cli).to receive(:ask_options).and_return('None')
159
- expect(subject.send(:template_name_to_apply)).to eq(nil)
160
- end
161
- end
162
- end
163
-
164
- describe '#mr_template_options' do
165
- it 'should call the local code' do
166
- expect(local_code).to receive(:template_options)
167
- subject.send(:mr_template_options)
168
- end
169
- end
170
-
171
- describe '#mr_id' do
172
- it 'should ask the CLI for the code request ID' do
173
- expect(highline_cli).to receive(:ask).and_return(Faker::Number.number)
174
- subject.send(:mr_id)
175
- end
176
-
177
- it 'should equal an integer' do
178
- pr_id = Faker::Number.number
179
- expect(highline_cli).to receive(:ask).and_return(pr_id)
180
- expect(subject.send(:mr_id)).to eq(pr_id)
181
- end
182
- end
183
-
184
- describe '#squash_merge_request' do
185
- it 'should ask the CLI for the code request ID' do
186
- expect(highline_cli).to receive(:ask_yes_no).and_return(true)
187
- subject.send(:squash_merge_request)
188
- end
189
-
190
- it 'should be a boolean' do
191
- expect(highline_cli).to receive(:ask_yes_no).and_return(false)
192
- expect([true, false]).to include(subject.send(:squash_merge_request))
193
- end
194
- end
195
-
196
- describe '#remove_source_branch' do
197
- before do
198
- allow(subject).to receive(:existing_project).and_return(double(remove_source_branch_after_merge: nil))
199
- end
200
-
201
- context 'when the existing project has no setting' do
202
- it 'should ask the CLI for the code request ID' do
203
- expect(highline_cli).to receive(:ask_yes_no).and_return(true)
204
- subject.send(:remove_source_branch)
205
- end
206
-
207
- it 'should be a boolean' do
208
- allow(highline_cli).to receive(:ask_yes_no).and_return(false)
209
- expect([true, false]).to include(subject.send(:remove_source_branch))
210
- end
211
- end
212
-
213
- it 'should ask the existing project' do
214
- expect(subject).to receive(:existing_project).and_return(double(remove_source_branch_after_merge: true))
215
- subject.send(:remove_source_branch)
216
- end
217
-
218
- it 'should return the existing projects setting if it exists' do
219
- allow(subject).to receive(:existing_project).and_return(double(remove_source_branch_after_merge: true))
220
- expect(subject.send(:remove_source_branch)).to eq(true)
221
- end
222
-
223
- it 'should return the existing projects setting if it exists' do
224
- allow(subject).to receive(:existing_project).and_return(double(remove_source_branch_after_merge: false))
225
- allow(highline_cli).to receive(:ask_yes_no).and_return(true)
226
- expect(subject.send(:remove_source_branch)).to eq(true)
227
- end
228
- end
229
-
230
- describe '#existing_project' do
231
- it 'should call the gitlab client' do
232
- expect(gitlab_client_client).to receive(:project).and_return(:project)
233
- subject.send(:existing_project)
234
- end
235
- end
236
-
237
- describe '#existing_mr' do
238
- it 'should call the gitlab client' do
239
- allow(highline_cli).to receive(:ask).and_return(Faker::Number.number)
240
- expect(gitlab_client_client).to receive(:merge_request).and_return(:merge_request)
241
- subject.send(:existing_mr)
242
- end
243
- end
244
-
245
- describe '#gitlab_client' do
246
- it 'should call the gitlab client' do
247
- expect(GitHelper::GitLabClient).to receive(:new).and_return(gitlab_client)
248
- subject.send(:gitlab_client)
249
- end
250
- end
251
- end
@@ -1,45 +0,0 @@
1
- require 'spec_helper'
2
- require 'git_helper'
3
-
4
- describe GitHelper::NewBranch do
5
- let(:new_branch_name) { 'new-branch-name' }
6
- let(:local_code) { double(:local_code, new_branch: :commit) }
7
- let(:cli) { double(:highline_cli, ask: new_branch_name) }
8
-
9
- subject { GitHelper::NewBranch.new }
10
-
11
- before do
12
- allow(GitHelper::LocalCode).to receive(:new).and_return(local_code)
13
- allow(GitHelper::HighlineCli).to receive(:new).and_return(cli)
14
- allow(subject).to receive(:puts)
15
- end
16
-
17
- it 'should call GitHelper::LocalCode' do
18
- expect(GitHelper::LocalCode).to receive(:new).and_return(local_code)
19
- subject.execute
20
- end
21
-
22
- it 'should call the new_branch method from the local code class' do
23
- expect(local_code).to receive(:new_branch)
24
- subject.execute
25
- end
26
-
27
- context 'when no branch name is passed in' do
28
- it 'should call the highline cli' do
29
- expect(GitHelper::HighlineCli).to receive(:new).and_return(cli)
30
- subject.execute
31
- end
32
-
33
- it 'should ask the highline cli what the new branch name should be' do
34
- expect(cli).to receive(:ask)
35
- subject.execute
36
- end
37
- end
38
-
39
- context 'when there is a branch name passed in' do
40
- it 'should not create a highline cli' do
41
- expect(GitHelper::HighlineCli).not_to receive(:new)
42
- subject.execute(new_branch_name)
43
- end
44
- end
45
- end
@@ -1,26 +0,0 @@
1
- require 'spec_helper'
2
- require 'git_helper'
3
-
4
- describe GitHelper::OctokitClient do
5
- let(:git_config_reader) { double(:git_config_reader, github_token: :token) }
6
-
7
- subject { GitHelper::OctokitClient.new }
8
-
9
- before do
10
- allow(GitHelper::GitConfigReader).to receive(:new).and_return(git_config_reader)
11
- end
12
-
13
- describe '#client' do
14
- it 'should call the GitLab client to make a new client' do
15
- expect(Octokit::Client).to receive(:new)
16
- subject.client
17
- end
18
- end
19
-
20
- describe '#git_config_reader' do
21
- it 'should make a new git config reader' do
22
- expect(GitHelper::GitConfigReader).to receive(:new)
23
- subject.send(:git_config_reader)
24
- end
25
- end
26
- end