git_helper 3.6.1 → 3.6.3

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.
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- require 'git_helper'
5
-
6
- describe GitHelper::CleanBranches do
7
- let(:local_code) { double(:local_code, clean_branches: :commit) }
8
-
9
- subject { GitHelper::CleanBranches.new }
10
-
11
- it 'should call GitHelper::LocalCode' do
12
- expect(GitHelper::LocalCode).to receive(:new).and_return(local_code)
13
- subject.execute
14
- end
15
-
16
- it 'should call the clean_branches method from the local code class' do
17
- allow(GitHelper::LocalCode).to receive(:new).and_return(local_code)
18
- expect(local_code).to receive(:clean_branches)
19
- subject.execute
20
- end
21
- end
@@ -1,265 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- require 'git_helper'
5
-
6
- describe GitHelper::CodeRequest do
7
- let(:highline_wrapper) { double(:highline_wrapper) }
8
- let(:local_code) { double(:local_code, project_name: Faker::Lorem.word, branch: Faker::Lorem.word) }
9
- let(:process_project) { double(:process_project, create: :created, merge: :merged) }
10
- let(:base_branch) { Faker::Lorem.word }
11
- let(:title) { Faker::Lorem.sentence }
12
-
13
- subject { GitHelper::CodeRequest.new }
14
-
15
- before do
16
- allow(GitHelper::LocalCode).to receive(:new).and_return(local_code)
17
- allow(HighlineWrapper).to receive(:new).and_return(highline_wrapper)
18
- allow(subject).to receive(:puts)
19
- end
20
-
21
- describe '#create' do
22
- before do
23
- allow(subject).to receive(:base_branch).and_return(base_branch)
24
- allow(subject).to receive(:new_code_request_title).and_return(title)
25
- end
26
-
27
- it 'should call to process the project' do
28
- expect(subject).to receive(:process_project).and_return(process_project)
29
- subject.create
30
- end
31
-
32
- it 'should call create' do
33
- allow(subject).to receive(:process_project).and_return(process_project)
34
- expect(process_project).to receive(:create)
35
- subject.create
36
- end
37
-
38
- it 'should call base_branch and new_code_request_title' do
39
- expect(subject).to receive(:base_branch).and_return(base_branch)
40
- expect(subject).to receive(:new_code_request_title).and_return(title)
41
- allow(subject).to receive(:process_project).and_return(process_project)
42
- allow(process_project).to receive(:create)
43
- subject.create
44
- end
45
- end
46
-
47
- describe '#merge' do
48
- it 'should call to process the project' do
49
- expect(subject).to receive(:process_project).and_return(process_project)
50
- subject.merge
51
- end
52
-
53
- it 'should call merge' do
54
- allow(subject).to receive(:process_project).and_return(process_project)
55
- expect(process_project).to receive(:merge)
56
- subject.merge
57
- end
58
- end
59
-
60
- describe '#process_project' do
61
- it 'should call the local code to see if it is a github or gitlab project' do
62
- expect(local_code).to receive(:gitlab_project?).and_return(false)
63
- expect(local_code).to receive(:github_repo?).and_return(true)
64
- subject.send(:process_project)
65
- end
66
-
67
- context 'when github and gitlab remotes are found' do
68
- it 'should ask for clarification' do
69
- allow(local_code).to receive(:gitlab_project?).and_return(true)
70
- allow(local_code).to receive(:github_repo?).and_return(true)
71
- expect(subject).to receive(:ask_for_clarification)
72
- subject.send(:process_project)
73
- end
74
- end
75
-
76
- context 'when github' do
77
- it 'should call the github_pull_request' do
78
- allow(local_code).to receive(:gitlab_project?).and_return(false)
79
- allow(local_code).to receive(:github_repo?).and_return(true)
80
- expect(subject).to receive(:github_pull_request)
81
- subject.send(:process_project)
82
- end
83
- end
84
-
85
- context 'when gitlab' do
86
- it 'should call the gitlab_merge_request' do
87
- allow(local_code).to receive(:gitlab_project?).and_return(true)
88
- allow(local_code).to receive(:github_repo?).and_return(false)
89
- expect(subject).to receive(:gitlab_merge_request)
90
- subject.send(:process_project)
91
- end
92
- end
93
-
94
- context 'when no github or gitlab remotes are found' do
95
- it 'should raise error' do
96
- allow(local_code).to receive(:gitlab_project?).and_return(false)
97
- allow(local_code).to receive(:github_repo?).and_return(false)
98
- expect(subject).to receive(:exit)
99
- subject.send(:process_project)
100
- end
101
- end
102
- end
103
-
104
- describe '#ask_for_clarification' do
105
- it 'should ask the CLI' do
106
- expect(highline_wrapper).to receive(:ask).and_return('github')
107
- subject.send(:ask_for_clarification)
108
- end
109
-
110
- context 'when response is github' do
111
- it 'should return github_pull_request' do
112
- allow(highline_wrapper).to receive(:ask).and_return('github')
113
- expect(subject).to receive(:github_pull_request)
114
- subject.send(:ask_for_clarification)
115
- end
116
-
117
- it 'should return github_pull_request' do
118
- allow(highline_wrapper).to receive(:ask).and_return('Github')
119
- expect(subject).to receive(:github_pull_request)
120
- subject.send(:ask_for_clarification)
121
- end
122
- end
123
-
124
- context 'when response is gitlab' do
125
- it 'should return gitlab_merge_request' do
126
- allow(highline_wrapper).to receive(:ask).and_return('gitlab')
127
- expect(subject).to receive(:gitlab_merge_request)
128
- subject.send(:ask_for_clarification)
129
- end
130
-
131
- it 'should return gitlab_merge_request' do
132
- allow(highline_wrapper).to receive(:ask).and_return('Gitlab')
133
- expect(subject).to receive(:gitlab_merge_request)
134
- subject.send(:ask_for_clarification)
135
- end
136
- end
137
-
138
- # Unfortunately this test sometimes fails... just rerun the tests if it does
139
- context 'when response is neither' do
140
- it 'should raise an error' do
141
- allow(highline_wrapper).to receive(:ask).and_return(Faker::Lorem.word)
142
- expect(subject).to receive(:exit)
143
- subject.send(:ask_for_clarification)
144
- end
145
- end
146
- end
147
-
148
- describe '#github_pull_request' do
149
- it 'should call the GitHelper::GitHubPullRequest' do
150
- expect(GitHelper::GitHubPullRequest).to receive(:new)
151
- subject.send(:github_pull_request)
152
- end
153
- end
154
-
155
- describe '#gitlab_merge_request' do
156
- it 'should call the GitHelper::GitLabMergeRequest' do
157
- expect(GitHelper::GitLabMergeRequest).to receive(:new)
158
- subject.send(:gitlab_merge_request)
159
- end
160
- end
161
-
162
- describe '#local_project' do
163
- it 'should call the name of the local_code' do
164
- expect(local_code).to receive(:project_name)
165
- subject.send(:local_project)
166
- end
167
- end
168
-
169
- describe '#default_branch' do
170
- it 'should call the name of the local_code' do
171
- expect(local_code).to receive(:default_branch)
172
- subject.send(:default_branch)
173
- end
174
- end
175
-
176
- describe '#base_branch' do
177
- it 'should call the default branch' do
178
- expect(subject).to receive(:default_branch)
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
- subject.send(:base_branch)
182
- end
183
-
184
- it 'should ask the CLI to ask the user' do
185
- allow(subject).to receive(:default_branch)
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
- subject.send(:base_branch)
189
- end
190
-
191
- context 'if the user says no' do
192
- it 'definitely asks for the users base branch' do
193
- allow(subject).to receive(:default_branch)
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
- subject.send(:base_branch)
197
- end
198
- end
199
-
200
- context 'if the user says yes' do
201
- it 'does not ask for the users base branch' do
202
- allow(subject).to receive(:default_branch)
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
- subject.send(:base_branch)
206
- end
207
- end
208
- end
209
-
210
- describe '#autogenerated_title' do
211
- it 'should generate a title based on the branch' do
212
- expect(subject).to receive(:local_branch).and_return(Faker::Lorem.word)
213
- expect(local_code).to receive(:generate_title)
214
- subject.send(:autogenerated_title)
215
- end
216
- end
217
-
218
- describe '#new_code_request_title' do
219
- it 'should call autogenerated title method' do
220
- expect(subject).to receive(:autogenerated_title)
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
- subject.send(:new_code_request_title)
224
- end
225
-
226
- it 'should ask the CLI to ask the user' do
227
- allow(subject).to receive(:autogenerated_title).and_return(Faker::Lorem.sentence)
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
- subject.send(:new_code_request_title)
231
- end
232
-
233
- context 'if the user says no' do
234
- it 'definitely asks for the users title' do
235
- allow(subject).to receive(:autogenerated_title).and_return(Faker::Lorem.sentence)
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
- subject.send(:new_code_request_title)
239
- end
240
- end
241
-
242
- context 'if the user says yes to original title' do
243
- it 'does not ask for the users chosen title' do
244
- allow(subject).to receive(:autogenerated_title).and_return(Faker::Lorem.sentence)
245
- expect(highline_wrapper).to receive(:ask_yes_no).at_least(:once).and_return(true)
246
- expect(highline_wrapper).not_to receive(:ask)
247
- subject.send(:new_code_request_title)
248
- end
249
- end
250
- end
251
-
252
- describe '#local_code' do
253
- it 'should call the GitHub client' do
254
- expect(GitHelper::LocalCode).to receive(:new).and_return(local_code)
255
- subject.send(:local_code)
256
- end
257
- end
258
-
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
- end
264
- end
265
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- require 'git_helper'
5
-
6
- describe GitHelper::EmptyCommit do
7
- let(:local_code) { double(:local_code, empty_commit: :commit) }
8
-
9
- subject { GitHelper::EmptyCommit.new }
10
-
11
- it 'should call GitHelper::LocalCode' do
12
- expect(GitHelper::LocalCode).to receive(:new).and_return(local_code)
13
- subject.execute
14
- end
15
-
16
- it 'should call the empty_commit method from the local code class' do
17
- allow(GitHelper::LocalCode).to receive(:new).and_return(local_code)
18
- expect(local_code).to receive(:empty_commit)
19
- subject.execute
20
- end
21
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- require 'git_helper'
5
-
6
- describe GitHelper::ForgetLocalCommits do
7
- let(:local_code) { double(:local_code, forget_local_commits: :commit) }
8
-
9
- subject { GitHelper::ForgetLocalCommits.new }
10
-
11
- it 'should call GitHelper::LocalCode' do
12
- expect(GitHelper::LocalCode).to receive(:new).and_return(local_code)
13
- subject.execute
14
- end
15
-
16
- it 'should call the forget_local_commits method from the local code class' do
17
- allow(GitHelper::LocalCode).to receive(:new).and_return(local_code)
18
- expect(local_code).to receive(:forget_local_commits)
19
- subject.execute
20
- end
21
- end
@@ -1,90 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- require 'git_helper'
5
-
6
- describe GitHelper::GitConfigReader do
7
- let(:github_user) { Faker::Internet.username }
8
- let(:github_token) { Faker::Internet.password(max_length: 10) }
9
- let(:gitlab_user) { Faker::Internet.username }
10
- let(:gitlab_token) { Faker::Internet.password(max_length: 10) }
11
-
12
- let(:config_file) do
13
- {
14
- github_user: github_user,
15
- github_token: github_token,
16
- gitlab_user: gitlab_user,
17
- gitlab_token: gitlab_token
18
- }
19
- end
20
-
21
- subject { GitHelper::GitConfigReader.new }
22
-
23
- describe '#gitlab_token' do
24
- it 'should locate the gitlab_token' do
25
- expect(subject).to receive(:config_file).and_return(config_file)
26
- expect(subject.gitlab_token).to eq(gitlab_token)
27
- end
28
-
29
- it 'should call the config file' do
30
- expect(subject).to receive(:config_file).and_return(config_file)
31
- subject.gitlab_token
32
- end
33
- end
34
-
35
- describe '#github_token' do
36
- it 'should locate the github_token' do
37
- expect(subject).to receive(:config_file).and_return(config_file)
38
- expect(subject.github_token).to eq(github_token)
39
- end
40
-
41
- it 'should call the config file' do
42
- expect(subject).to receive(:config_file).and_return(config_file)
43
- subject.github_token
44
- end
45
- end
46
-
47
- describe '#github_user' do
48
- it 'should locate the github_user' do
49
- expect(subject).to receive(:config_file).and_return(config_file)
50
- expect(subject.github_user).to eq(github_user)
51
- end
52
-
53
- it 'should call the config file' do
54
- expect(subject).to receive(:config_file).and_return(config_file)
55
- subject.github_user
56
- end
57
- end
58
-
59
- describe '#gitlab_user' do
60
- it 'should locate the gitlab_user' do
61
- expect(subject).to receive(:config_file).and_return(config_file)
62
- expect(subject.gitlab_user).to eq(gitlab_user)
63
- end
64
-
65
- it 'should call the config file' do
66
- expect(subject).to receive(:config_file).and_return(config_file)
67
- subject.gitlab_user
68
- end
69
- end
70
-
71
- describe '#config_file' do
72
- it 'should yaml load the file path' do
73
- expect(YAML).to receive(:load_file)
74
- subject.send(:config_file)
75
- end
76
- end
77
-
78
- describe '#git_config_file_path' do
79
- it 'should look in the current directory' do
80
- expect(Dir).to receive(:pwd).and_return("/Users/#{Faker::Name.first_name}/#{Faker::Lorem.word}")
81
- subject.send(:git_config_file_path)
82
- end
83
-
84
- it 'should return the base path with the git config file at the end' do
85
- user = Faker::Name.first_name
86
- allow(Dir).to receive(:pwd).and_return("/Users/#{user}/#{Faker::Lorem.word}")
87
- expect(subject.send(:git_config_file_path)).to eq("/Users/#{user}/.git_helper/config.yml")
88
- end
89
- end
90
- end
@@ -1,131 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- require 'git_helper'
5
-
6
- describe GitHelper::GitHubClient do
7
- let(:git_config_reader) { double(:git_config_reader, github_token: :token) }
8
-
9
- subject { GitHelper::GitHubClient.new }
10
-
11
- before do
12
- allow(GitHelper::GitConfigReader).to receive(:new).and_return(git_config_reader)
13
- end
14
-
15
- describe '#repository' do
16
- it 'should call to run a query' do
17
- expect(subject).to receive(:run)
18
- subject.repository(Faker::Lorem.word)
19
- end
20
-
21
- it "should return the run command's answer" do
22
- expect(subject).to receive(:run).and_return(:command_complete)
23
- expect(subject.repository(Faker::Lorem.word)).to eq(:command_complete)
24
- end
25
- end
26
-
27
- describe '#pull_request' do
28
- it 'should call to run a query' do
29
- expect(subject).to receive(:run)
30
- subject.pull_request(Faker::Lorem.word, Faker::Number.number)
31
- end
32
-
33
- it "should return the run command's answer" do
34
- expect(subject).to receive(:run).and_return(:command_complete)
35
- expect(subject.pull_request(Faker::Lorem.word, Faker::Number.number)).to eq(:command_complete)
36
- end
37
- end
38
-
39
- describe '#create_pull_request' do
40
- it 'should call to run a query' do
41
- expect(subject).to receive(:run)
42
- subject.create_pull_request(Faker::Lorem.word, {})
43
- end
44
-
45
- it 'should generate a string list of options' do
46
- expect(subject).to receive(:format_options).with({})
47
- subject.create_pull_request(Faker::Lorem.word, {})
48
- end
49
-
50
- it "should return the run command's answer" do
51
- expect(subject).to receive(:run).and_return(:command_complete)
52
- expect(subject.create_pull_request(Faker::Lorem.word, {})).to eq(:command_complete)
53
- end
54
- end
55
-
56
- describe '#merge_pull_request' do
57
- it 'should call to run a query' do
58
- expect(subject).to receive(:run)
59
- subject.merge_pull_request(Faker::Lorem.word, Faker::Number.number, {})
60
- end
61
-
62
- it 'should generate a string list of options' do
63
- expect(subject).to receive(:format_options).with({})
64
- subject.merge_pull_request(Faker::Lorem.word, Faker::Number.number, {})
65
- end
66
-
67
- it "should return the run command's answer" do
68
- expect(subject).to receive(:run).and_return(:command_complete)
69
- expect(subject.merge_pull_request(Faker::Lorem.word, Faker::Number.number, {})).to eq(:command_complete)
70
- end
71
- end
72
-
73
- describe '#format_options' do
74
- it 'will make a list of hash options into a JSON parsed chunk of key/value pairs as string' do
75
- options = {
76
- key1: 'value1',
77
- key2: true,
78
- key3: '',
79
- key4: false,
80
- key5: 'value5'
81
- }
82
- # rubocop:disable Style/StringLiterals
83
- result = "{\"key1\":\"value1\",\"key2\":true,\"key4\":false,\"key5\":\"value5\"}"
84
- # rubocop:enable Style/StringLiterals
85
- expect(subject.send(:format_options, options)).to eq(result)
86
- end
87
-
88
- it 'will return an empty string if an empty hash is given' do
89
- expect(subject.send(:format_options, {})).to eq('')
90
- end
91
-
92
- it 'will return an empty string if all values are empty strings' do
93
- options = {
94
- key1: '',
95
- key2: '',
96
- key3: ''
97
- }
98
- expect(subject.send(:format_options, options)).to eq('')
99
- end
100
- end
101
-
102
- describe '#run' do
103
- it 'should call CURL' do
104
- expect(subject).to receive(:`).and_return('{}')
105
- subject.send(:run, Faker::Lorem.word, 'GET', "/projects/#{Faker::Lorem.word}")
106
- end
107
-
108
- it 'should use JSON to parse the response' do
109
- expect(JSON).to receive(:parse).and_return({})
110
- subject.send(:run, Faker::Lorem.word, 'GET', "/projects/#{Faker::Lorem.word}")
111
- end
112
-
113
- it 'should use OpenStruct to turn the hash into an object' do
114
- expect(OpenStruct).to receive(:new).and_return(OpenStruct.new)
115
- subject.send(:run, Faker::Lorem.word, 'GET', "/projects/#{Faker::Lorem.word}")
116
- end
117
- end
118
-
119
- describe '#github_token' do
120
- it 'should return a token' do
121
- expect(subject.send(:github_token)).to eq(:token)
122
- end
123
- end
124
-
125
- describe '#git_config_reader' do
126
- it 'should make a new git config reader' do
127
- expect(GitHelper::GitConfigReader).to receive(:new)
128
- subject.send(:git_config_reader)
129
- end
130
- end
131
- end
@@ -1,144 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- require 'git_helper'
5
-
6
- describe GitHelper::GitLabClient do
7
- let(:git_config_reader) { double(:git_config_reader, gitlab_token: :token) }
8
-
9
- subject { GitHelper::GitLabClient.new }
10
-
11
- before do
12
- allow(GitHelper::GitConfigReader).to receive(:new).and_return(git_config_reader)
13
- end
14
-
15
- describe '#project' do
16
- it 'should call to run a query' do
17
- expect(subject).to receive(:run)
18
- subject.project(Faker::Lorem.word)
19
- end
20
-
21
- it "should return the run command's answer" do
22
- expect(subject).to receive(:run).and_return(:command_complete)
23
- expect(subject.project(Faker::Lorem.word)).to eq(:command_complete)
24
- end
25
- end
26
-
27
- describe '#merge_request' do
28
- it 'should call to run a query' do
29
- expect(subject).to receive(:run)
30
- subject.merge_request(Faker::Lorem.word, Faker::Number.number)
31
- end
32
-
33
- it "should return the run command's answer" do
34
- expect(subject).to receive(:run).and_return(:command_complete)
35
- expect(subject.merge_request(Faker::Lorem.word, Faker::Number.number)).to eq(:command_complete)
36
- end
37
- end
38
-
39
- describe '#create_merge_request' do
40
- it 'should call to run a query' do
41
- expect(subject).to receive(:run)
42
- subject.create_merge_request(Faker::Lorem.word, {})
43
- end
44
-
45
- it 'should generate a string list of options' do
46
- expect(subject).to receive(:format_options).with({})
47
- subject.create_merge_request(Faker::Lorem.word, {})
48
- end
49
-
50
- it "should return the run command's answer" do
51
- expect(subject).to receive(:run).and_return(:command_complete)
52
- expect(subject.create_merge_request(Faker::Lorem.word, {})).to eq(:command_complete)
53
- end
54
- end
55
-
56
- describe '#accept_merge_request' do
57
- it 'should call to run a query' do
58
- expect(subject).to receive(:run)
59
- subject.accept_merge_request(Faker::Lorem.word, Faker::Number.number, {})
60
- end
61
-
62
- it 'should generate a string list of options' do
63
- expect(subject).to receive(:format_options).with({})
64
- subject.accept_merge_request(Faker::Lorem.word, Faker::Number.number, {})
65
- end
66
-
67
- it "should return the run command's answer" do
68
- expect(subject).to receive(:run).and_return(:command_complete)
69
- expect(subject.accept_merge_request(Faker::Lorem.word, Faker::Number.number, {})).to eq(:command_complete)
70
- end
71
- end
72
-
73
- describe '#format_options' do
74
- it 'will make a list of hash options into a URL string' do
75
- options = {
76
- key1: 'value1',
77
- key2: true,
78
- key3: '',
79
- key4: false,
80
- key5: 'value5'
81
- }
82
- result = '?key1=value1&key2=true&key4=false&key5=value5'
83
- expect(subject.send(:format_options, options)).to eq(result)
84
- end
85
-
86
- it 'will return an empty string if an empty hash is given' do
87
- expect(subject.send(:format_options, {})).to eq('')
88
- end
89
-
90
- it 'will return an empty string if all values are empty strings' do
91
- options = {
92
- key1: '',
93
- key2: '',
94
- key3: ''
95
- }
96
- expect(subject.send(:format_options, options)).to eq('')
97
- end
98
- end
99
-
100
- describe '#run' do
101
- it 'should call CURL' do
102
- expect(subject).to receive(:`).and_return('{}')
103
- subject.send(:run, 'GET', "/projects/#{Faker::Lorem.word}")
104
- end
105
-
106
- it 'should use JSON to parse the response' do
107
- expect(JSON).to receive(:parse).and_return({})
108
- subject.send(:run, 'GET', "/projects/#{Faker::Lorem.word}")
109
- end
110
-
111
- it 'should use OpenStruct to turn the hash into an object' do
112
- expect(OpenStruct).to receive(:new).and_return(OpenStruct.new)
113
- subject.send(:run, 'GET', "/projects/#{Faker::Lorem.word}")
114
- end
115
- end
116
-
117
- describe '#url_encode' do
118
- let(:group_name) { Faker::Lorem.word }
119
- let(:project_name) { Faker::Lorem.word }
120
-
121
- it 'should return the same string as passed in but with no spaces' do
122
- expect(subject.send(:url_encode, "#{group_name}/#{project_name}")).to eq("#{group_name}%2F#{project_name}")
123
- end
124
-
125
- it 'should never include a space or a slash' do
126
- resp = subject.send(:url_encode, "#{group_name} #{Faker::Lorem.word}/#{project_name}")
127
- expect(resp).not_to include(' ')
128
- expect(resp).not_to include('/')
129
- end
130
- end
131
-
132
- describe '#gitlab_token' do
133
- it 'should return a token' do
134
- expect(subject.send(:gitlab_token)).to eq(:token)
135
- end
136
- end
137
-
138
- describe '#git_config_reader' do
139
- it 'should make a new git config reader' do
140
- expect(GitHelper::GitConfigReader).to receive(:new)
141
- subject.send(:git_config_reader)
142
- end
143
- end
144
- end