coveralls_reborn 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +59 -0
- data/.travis.yml +9 -4
- data/Gemfile +17 -16
- data/LICENSE +17 -18
- data/README.md +7 -1
- data/Rakefile +9 -3
- data/bin/coveralls +2 -1
- data/coveralls-ruby.gemspec +15 -13
- data/lib/coveralls/api.rb +72 -68
- data/lib/coveralls/command.rb +28 -24
- data/lib/coveralls/configuration.rb +46 -52
- data/lib/coveralls/output.rb +12 -7
- data/lib/coveralls/rake/task.rb +7 -6
- data/lib/coveralls/simplecov.rb +34 -32
- data/lib/coveralls/version.rb +3 -1
- data/lib/coveralls.rb +43 -41
- data/spec/coveralls/configuration_spec.rb +212 -160
- data/spec/coveralls/coveralls_spec.rb +41 -46
- data/spec/coveralls/fixtures/app/controllers/sample.rb +2 -0
- data/spec/coveralls/fixtures/app/models/airplane.rb +4 -2
- data/spec/coveralls/output_spec.rb +38 -51
- data/spec/coveralls/simple_cov/formatter_spec.rb +82 -0
- data/spec/spec_helper.rb +15 -18
- metadata +21 -16
- data/spec/coveralls/simplecov_spec.rb +0 -82
@@ -1,166 +1,189 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Coveralls::Configuration do
|
4
6
|
before do
|
5
|
-
ENV.
|
7
|
+
allow(ENV).to receive(:[]).and_return(nil)
|
6
8
|
end
|
7
9
|
|
8
10
|
describe '.configuration' do
|
9
|
-
it
|
10
|
-
config =
|
11
|
-
config.
|
12
|
-
config.keys.
|
13
|
-
config.keys.
|
11
|
+
it 'returns a hash with the default keys' do
|
12
|
+
config = described_class.configuration
|
13
|
+
expect(config).to be_a(Hash)
|
14
|
+
expect(config.keys).to include(:environment)
|
15
|
+
expect(config.keys).to include(:git)
|
14
16
|
end
|
15
17
|
|
16
|
-
context 'yaml_config' do
|
18
|
+
context 'with yaml_config' do
|
17
19
|
let(:repo_token) { SecureRandom.hex(4) }
|
18
20
|
let(:repo_secret_token) { SecureRandom.hex(4) }
|
19
|
-
let(:yaml_config)
|
21
|
+
let(:yaml_config) do
|
20
22
|
{
|
21
23
|
'repo_token' => repo_token,
|
22
24
|
'repo_secret_token' => repo_secret_token
|
23
25
|
}
|
24
|
-
|
26
|
+
end
|
25
27
|
|
26
28
|
before do
|
27
|
-
|
29
|
+
allow(described_class).to receive(:yaml_config).and_return(yaml_config)
|
28
30
|
end
|
29
31
|
|
30
32
|
it 'sets the Yaml config and associated variables if present' do
|
31
|
-
config =
|
32
|
-
config[:configuration].
|
33
|
-
config[:repo_token].
|
33
|
+
config = described_class.configuration
|
34
|
+
expect(config[:configuration]).to eq(yaml_config)
|
35
|
+
expect(config[:repo_token]).to eq(repo_token)
|
34
36
|
end
|
35
37
|
|
36
38
|
it 'uses the repo_secret_token if the repo_token is not set' do
|
37
39
|
yaml_config.delete('repo_token')
|
38
|
-
config =
|
39
|
-
config[:configuration].
|
40
|
-
config[:repo_token].
|
40
|
+
config = described_class.configuration
|
41
|
+
expect(config[:configuration]).to eq(yaml_config)
|
42
|
+
expect(config[:repo_token]).to eq(repo_secret_token)
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
44
|
-
context 'repo_token in environment' do
|
46
|
+
context 'when repo_token is in environment' do
|
45
47
|
let(:repo_token) { SecureRandom.hex(4) }
|
46
48
|
|
47
49
|
before do
|
48
|
-
ENV.
|
50
|
+
allow(ENV).to receive(:[]).with('COVERALLS_REPO_TOKEN').and_return(repo_token)
|
49
51
|
end
|
50
52
|
|
51
53
|
it 'pulls the repo token from the environment if set' do
|
52
|
-
config =
|
53
|
-
config[:repo_token].
|
54
|
+
config = described_class.configuration
|
55
|
+
expect(config[:repo_token]).to eq(repo_token)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
context 'when parallel is in environment' do
|
60
|
+
before do
|
61
|
+
allow(ENV).to receive(:[]).with('COVERALLS_PARALLEL').and_return(true)
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'sets parallel to true if present' do
|
65
|
+
config = described_class.configuration
|
66
|
+
expect(config[:parallel]).to be true
|
54
67
|
end
|
55
68
|
end
|
56
69
|
|
57
|
-
context '
|
70
|
+
context 'with services' do
|
71
|
+
before do
|
72
|
+
allow(described_class).to receive(:set_service_params_for_travis)
|
73
|
+
allow(described_class).to receive(:set_service_params_for_circleci)
|
74
|
+
allow(described_class).to receive(:set_service_params_for_semaphore)
|
75
|
+
allow(described_class).to receive(:set_service_params_for_jenkins)
|
76
|
+
allow(described_class).to receive(:set_service_params_for_coveralls_local)
|
77
|
+
allow(described_class).to receive(:set_standard_service_params_for_generic_ci)
|
78
|
+
end
|
79
|
+
|
58
80
|
context 'with env based service name' do
|
59
81
|
let(:service_name) { 'travis-enterprise' }
|
82
|
+
|
60
83
|
before do
|
61
|
-
ENV.
|
62
|
-
ENV.
|
84
|
+
allow(ENV).to receive(:[]).with('TRAVIS').and_return('1')
|
85
|
+
allow(ENV).to receive(:[]).with('COVERALLS_SERVICE_NAME').and_return(service_name)
|
63
86
|
end
|
64
87
|
|
65
88
|
it 'pulls the service name from the environment if set' do
|
66
|
-
config =
|
67
|
-
config[:service_name].
|
89
|
+
config = described_class.configuration
|
90
|
+
expect(config[:service_name]).to eq(service_name)
|
68
91
|
end
|
69
92
|
end
|
70
93
|
|
71
|
-
context '
|
94
|
+
context 'when using Travis' do
|
72
95
|
before do
|
73
|
-
ENV.
|
96
|
+
allow(ENV).to receive(:[]).with('TRAVIS').and_return('1')
|
97
|
+
described_class.configuration
|
74
98
|
end
|
75
99
|
|
76
|
-
it '
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
Coveralls::Configuration.configuration
|
100
|
+
it 'sets service parameters for this service and no other' do
|
101
|
+
expect(described_class).to have_received(:set_service_params_for_travis).with(anything, anything)
|
102
|
+
expect(described_class).not_to have_received(:set_service_params_for_circleci)
|
103
|
+
expect(described_class).not_to have_received(:set_service_params_for_semaphore)
|
104
|
+
expect(described_class).not_to have_received(:set_service_params_for_jenkins)
|
105
|
+
expect(described_class).not_to have_received(:set_service_params_for_coveralls_local)
|
106
|
+
expect(described_class).to have_received(:set_standard_service_params_for_generic_ci)
|
84
107
|
end
|
85
108
|
end
|
86
109
|
|
87
|
-
context '
|
110
|
+
context 'when using CircleCI' do
|
88
111
|
before do
|
89
|
-
ENV.
|
112
|
+
allow(ENV).to receive(:[]).with('CIRCLECI').and_return('1')
|
113
|
+
described_class.configuration
|
90
114
|
end
|
91
115
|
|
92
|
-
it '
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
Coveralls::Configuration.configuration
|
116
|
+
it 'sets service parameters for this service and no other' do
|
117
|
+
expect(described_class).not_to have_received(:set_service_params_for_travis)
|
118
|
+
expect(described_class).to have_received(:set_service_params_for_circleci)
|
119
|
+
expect(described_class).not_to have_received(:set_service_params_for_semaphore)
|
120
|
+
expect(described_class).not_to have_received(:set_service_params_for_jenkins)
|
121
|
+
expect(described_class).not_to have_received(:set_service_params_for_coveralls_local)
|
122
|
+
expect(described_class).to have_received(:set_standard_service_params_for_generic_ci)
|
100
123
|
end
|
101
124
|
end
|
102
125
|
|
103
|
-
context '
|
126
|
+
context 'when using Semaphore' do
|
104
127
|
before do
|
105
|
-
ENV.
|
128
|
+
allow(ENV).to receive(:[]).with('SEMAPHORE').and_return('1')
|
129
|
+
described_class.configuration
|
106
130
|
end
|
107
131
|
|
108
|
-
it '
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
Coveralls::Configuration.configuration
|
132
|
+
it 'sets service parameters for this service and no other' do
|
133
|
+
expect(described_class).not_to have_received(:set_service_params_for_travis)
|
134
|
+
expect(described_class).not_to have_received(:set_service_params_for_circleci)
|
135
|
+
expect(described_class).to have_received(:set_service_params_for_semaphore)
|
136
|
+
expect(described_class).not_to have_received(:set_service_params_for_jenkins)
|
137
|
+
expect(described_class).not_to have_received(:set_service_params_for_coveralls_local)
|
138
|
+
expect(described_class).to have_received(:set_standard_service_params_for_generic_ci)
|
116
139
|
end
|
117
140
|
end
|
118
141
|
|
119
142
|
context 'when using Jenkins' do
|
120
143
|
before do
|
121
|
-
ENV.
|
144
|
+
allow(ENV).to receive(:[]).with('JENKINS_URL').and_return('1')
|
145
|
+
described_class.configuration
|
122
146
|
end
|
123
147
|
|
124
|
-
it '
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
Coveralls::Configuration.configuration
|
148
|
+
it 'sets service parameters for this service and no other' do
|
149
|
+
expect(described_class).not_to have_received(:set_service_params_for_travis)
|
150
|
+
expect(described_class).not_to have_received(:set_service_params_for_circleci)
|
151
|
+
expect(described_class).not_to have_received(:set_service_params_for_semaphore)
|
152
|
+
expect(described_class).to have_received(:set_service_params_for_jenkins)
|
153
|
+
expect(described_class).not_to have_received(:set_service_params_for_coveralls_local)
|
154
|
+
expect(described_class).to have_received(:set_standard_service_params_for_generic_ci)
|
132
155
|
end
|
133
156
|
end
|
134
157
|
|
135
158
|
context 'when running Coveralls locally' do
|
136
159
|
before do
|
137
|
-
ENV.
|
160
|
+
allow(ENV).to receive(:[]).with('COVERALLS_RUN_LOCALLY').and_return('1')
|
161
|
+
described_class.configuration
|
138
162
|
end
|
139
163
|
|
140
|
-
it '
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
Coveralls::Configuration.configuration
|
164
|
+
it 'sets service parameters for this service and no other' do
|
165
|
+
expect(described_class).not_to have_received(:set_service_params_for_travis)
|
166
|
+
expect(described_class).not_to have_received(:set_service_params_for_circleci)
|
167
|
+
expect(described_class).not_to have_received(:set_service_params_for_semaphore)
|
168
|
+
expect(described_class).not_to have_received(:set_service_params_for_jenkins)
|
169
|
+
expect(described_class).to have_received(:set_service_params_for_coveralls_local)
|
170
|
+
expect(described_class).to have_received(:set_standard_service_params_for_generic_ci)
|
148
171
|
end
|
149
172
|
end
|
150
173
|
|
151
|
-
context '
|
174
|
+
context 'when using a generic CI' do
|
152
175
|
before do
|
153
|
-
ENV.
|
176
|
+
allow(ENV).to receive(:[]).with('CI_NAME').and_return('1')
|
177
|
+
described_class.configuration
|
154
178
|
end
|
155
179
|
|
156
|
-
it '
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
Coveralls::Configuration.configuration
|
180
|
+
it 'sets service parameters for this service and no other' do
|
181
|
+
expect(described_class).not_to have_received(:set_service_params_for_travis)
|
182
|
+
expect(described_class).not_to have_received(:set_service_params_for_circleci)
|
183
|
+
expect(described_class).not_to have_received(:set_service_params_for_semaphore)
|
184
|
+
expect(described_class).not_to have_received(:set_service_params_for_jenkins)
|
185
|
+
expect(described_class).not_to have_received(:set_service_params_for_coveralls_local)
|
186
|
+
expect(described_class).to have_received(:set_standard_service_params_for_generic_ci).with(anything)
|
164
187
|
end
|
165
188
|
end
|
166
189
|
end
|
@@ -168,107 +191,111 @@ describe Coveralls::Configuration do
|
|
168
191
|
|
169
192
|
describe '.set_service_params_for_travis' do
|
170
193
|
let(:travis_job_id) { SecureRandom.hex(4) }
|
194
|
+
|
171
195
|
before do
|
172
|
-
ENV.
|
196
|
+
allow(ENV).to receive(:[]).with('TRAVIS_JOB_ID').and_return(travis_job_id)
|
173
197
|
end
|
174
198
|
|
175
|
-
it '
|
199
|
+
it 'sets the service_job_id' do
|
176
200
|
config = {}
|
177
|
-
|
178
|
-
config[:service_job_id].
|
201
|
+
described_class.set_service_params_for_travis(config, nil)
|
202
|
+
expect(config[:service_job_id]).to eq(travis_job_id)
|
179
203
|
end
|
180
204
|
|
181
|
-
it '
|
205
|
+
it 'sets the service_name to travis-ci by default' do
|
182
206
|
config = {}
|
183
|
-
|
184
|
-
config[:service_name].
|
207
|
+
described_class.set_service_params_for_travis(config, nil)
|
208
|
+
expect(config[:service_name]).to eq('travis-ci')
|
185
209
|
end
|
186
210
|
|
187
|
-
it '
|
211
|
+
it 'sets the service_name to a value if one is passed in' do
|
188
212
|
config = {}
|
189
213
|
random_name = SecureRandom.hex(4)
|
190
|
-
|
191
|
-
config[:service_name].
|
214
|
+
described_class.set_service_params_for_travis(config, random_name)
|
215
|
+
expect(config[:service_name]).to eq(random_name)
|
192
216
|
end
|
193
217
|
end
|
194
218
|
|
195
219
|
describe '.set_service_params_for_circleci' do
|
196
220
|
let(:circle_build_num) { SecureRandom.hex(4) }
|
221
|
+
|
197
222
|
before do
|
198
|
-
ENV.
|
223
|
+
allow(ENV).to receive(:[]).with('CIRCLE_BUILD_NUM').and_return(circle_build_num)
|
199
224
|
end
|
200
225
|
|
201
|
-
it '
|
226
|
+
it 'sets the expected parameters' do
|
202
227
|
config = {}
|
203
|
-
|
204
|
-
config[:service_name].
|
205
|
-
config[:service_number].
|
228
|
+
described_class.set_service_params_for_circleci(config)
|
229
|
+
expect(config[:service_name]).to eq('circleci')
|
230
|
+
expect(config[:service_number]).to eq(circle_build_num)
|
206
231
|
end
|
207
232
|
end
|
208
233
|
|
209
234
|
describe '.set_service_params_for_gitlab' do
|
210
235
|
let(:commit_sha) { SecureRandom.hex(32) }
|
211
|
-
let(:service_job_number) {
|
236
|
+
let(:service_job_number) { 'spec:one' }
|
212
237
|
let(:service_job_id) { 1234 }
|
213
|
-
let(:service_branch) {
|
238
|
+
let(:service_branch) { 'feature' }
|
214
239
|
|
215
240
|
before do
|
216
|
-
ENV.
|
217
|
-
ENV.
|
218
|
-
ENV.
|
219
|
-
ENV.
|
241
|
+
allow(ENV).to receive(:[]).with('CI_BUILD_NAME').and_return(service_job_number)
|
242
|
+
allow(ENV).to receive(:[]).with('CI_BUILD_ID').and_return(service_job_id)
|
243
|
+
allow(ENV).to receive(:[]).with('CI_BUILD_REF_NAME').and_return(service_branch)
|
244
|
+
allow(ENV).to receive(:[]).with('CI_BUILD_REF').and_return(commit_sha)
|
220
245
|
end
|
221
246
|
|
222
|
-
it '
|
247
|
+
it 'sets the expected parameters' do
|
223
248
|
config = {}
|
224
|
-
|
225
|
-
config[:service_name].
|
226
|
-
config[:service_job_number].
|
227
|
-
config[:service_job_id].
|
228
|
-
config[:service_branch].
|
229
|
-
config[:commit_sha].
|
249
|
+
described_class.set_service_params_for_gitlab(config)
|
250
|
+
expect(config[:service_name]).to eq('gitlab-ci')
|
251
|
+
expect(config[:service_job_number]).to eq(service_job_number)
|
252
|
+
expect(config[:service_job_id]).to eq(service_job_id)
|
253
|
+
expect(config[:service_branch]).to eq(service_branch)
|
254
|
+
expect(config[:commit_sha]).to eq(commit_sha)
|
230
255
|
end
|
231
256
|
end
|
232
257
|
|
233
258
|
describe '.set_service_params_for_semaphore' do
|
234
259
|
let(:semaphore_build_num) { SecureRandom.hex(4) }
|
260
|
+
|
235
261
|
before do
|
236
|
-
ENV.
|
262
|
+
allow(ENV).to receive(:[]).with('SEMAPHORE_BUILD_NUMBER').and_return(semaphore_build_num)
|
237
263
|
end
|
238
264
|
|
239
|
-
it '
|
265
|
+
it 'sets the expected parameters' do
|
240
266
|
config = {}
|
241
|
-
|
242
|
-
config[:service_name].
|
243
|
-
config[:service_number].
|
267
|
+
described_class.set_service_params_for_semaphore(config)
|
268
|
+
expect(config[:service_name]).to eq('semaphore')
|
269
|
+
expect(config[:service_number]).to eq(semaphore_build_num)
|
244
270
|
end
|
245
271
|
end
|
246
272
|
|
247
273
|
describe '.set_service_params_for_jenkins' do
|
248
274
|
let(:service_pull_request) { '1234' }
|
249
275
|
let(:build_num) { SecureRandom.hex(4) }
|
276
|
+
|
250
277
|
before do
|
251
|
-
ENV.
|
252
|
-
ENV.
|
278
|
+
allow(ENV).to receive(:[]).with('CI_PULL_REQUEST').and_return(service_pull_request)
|
279
|
+
allow(ENV).to receive(:[]).with('BUILD_NUMBER').and_return(build_num)
|
253
280
|
end
|
254
281
|
|
255
|
-
it '
|
282
|
+
it 'sets the expected parameters' do
|
256
283
|
config = {}
|
257
|
-
|
258
|
-
|
259
|
-
config[:service_name].
|
260
|
-
config[:service_number].
|
261
|
-
config[:service_pull_request].
|
284
|
+
described_class.set_service_params_for_jenkins(config)
|
285
|
+
described_class.set_standard_service_params_for_generic_ci(config)
|
286
|
+
expect(config[:service_name]).to eq('jenkins')
|
287
|
+
expect(config[:service_number]).to eq(build_num)
|
288
|
+
expect(config[:service_pull_request]).to eq(service_pull_request)
|
262
289
|
end
|
263
290
|
end
|
264
291
|
|
265
292
|
describe '.set_service_params_for_coveralls_local' do
|
266
|
-
it '
|
293
|
+
it 'sets the expected parameters' do
|
267
294
|
config = {}
|
268
|
-
|
269
|
-
config[:service_name].
|
270
|
-
config[:service_job_id].
|
271
|
-
config[:service_event_type].
|
295
|
+
described_class.set_service_params_for_coveralls_local(config)
|
296
|
+
expect(config[:service_name]).to eq('coveralls-ruby')
|
297
|
+
expect(config[:service_job_id]).to be_nil
|
298
|
+
expect(config[:service_event_type]).to eq('manual')
|
272
299
|
end
|
273
300
|
end
|
274
301
|
|
@@ -280,21 +307,21 @@ describe Coveralls::Configuration do
|
|
280
307
|
let(:service_pull_request) { '1234' }
|
281
308
|
|
282
309
|
before do
|
283
|
-
ENV.
|
284
|
-
ENV.
|
285
|
-
ENV.
|
286
|
-
ENV.
|
287
|
-
ENV.
|
310
|
+
allow(ENV).to receive(:[]).with('CI_NAME').and_return(service_name)
|
311
|
+
allow(ENV).to receive(:[]).with('CI_BUILD_NUMBER').and_return(service_number)
|
312
|
+
allow(ENV).to receive(:[]).with('CI_BUILD_URL').and_return(service_build_url)
|
313
|
+
allow(ENV).to receive(:[]).with('CI_BRANCH').and_return(service_branch)
|
314
|
+
allow(ENV).to receive(:[]).with('CI_PULL_REQUEST').and_return(service_pull_request)
|
288
315
|
end
|
289
316
|
|
290
|
-
it '
|
317
|
+
it 'sets the expected parameters' do
|
291
318
|
config = {}
|
292
|
-
|
293
|
-
config[:service_name].
|
294
|
-
config[:service_number].
|
295
|
-
config[:service_build_url].
|
296
|
-
config[:service_branch].
|
297
|
-
config[:service_pull_request].
|
319
|
+
described_class.set_standard_service_params_for_generic_ci(config)
|
320
|
+
expect(config[:service_name]).to eq(service_name)
|
321
|
+
expect(config[:service_number]).to eq(service_number)
|
322
|
+
expect(config[:service_build_url]).to eq(service_build_url)
|
323
|
+
expect(config[:service_branch]).to eq(service_branch)
|
324
|
+
expect(config[:service_pull_request]).to eq(service_pull_request)
|
298
325
|
end
|
299
326
|
end
|
300
327
|
|
@@ -305,20 +332,45 @@ describe Coveralls::Configuration do
|
|
305
332
|
let(:repo_name) { SecureRandom.hex(4) }
|
306
333
|
|
307
334
|
before do
|
308
|
-
ENV.
|
309
|
-
ENV.
|
310
|
-
ENV.
|
311
|
-
ENV.
|
335
|
+
allow(ENV).to receive(:[]).with('APPVEYOR_BUILD_VERSION').and_return(service_number)
|
336
|
+
allow(ENV).to receive(:[]).with('APPVEYOR_REPO_BRANCH').and_return(service_branch)
|
337
|
+
allow(ENV).to receive(:[]).with('APPVEYOR_REPO_COMMIT').and_return(commit_sha)
|
338
|
+
allow(ENV).to receive(:[]).with('APPVEYOR_REPO_NAME').and_return(repo_name)
|
339
|
+
end
|
340
|
+
|
341
|
+
it 'sets the expected parameters' do
|
342
|
+
config = {}
|
343
|
+
described_class.set_service_params_for_appveyor(config)
|
344
|
+
expect(config[:service_name]).to eq('appveyor')
|
345
|
+
expect(config[:service_number]).to eq(service_number)
|
346
|
+
expect(config[:service_branch]).to eq(service_branch)
|
347
|
+
expect(config[:commit_sha]).to eq(commit_sha)
|
348
|
+
expect(config[:service_build_url]).to eq(format('https://ci.appveyor.com/project/%s/build/%s', repo_name, service_number))
|
349
|
+
end
|
350
|
+
end
|
351
|
+
|
352
|
+
describe '.set_service_params_for_tddium' do
|
353
|
+
let(:service_number) { SecureRandom.hex(4) }
|
354
|
+
let(:service_job_number) { SecureRandom.hex(4) }
|
355
|
+
let(:service_pull_request) { SecureRandom.hex(4) }
|
356
|
+
let(:service_branch) { SecureRandom.hex(4) }
|
357
|
+
|
358
|
+
before do
|
359
|
+
allow(ENV).to receive(:[]).with('TDDIUM_SESSION_ID').and_return(service_number)
|
360
|
+
allow(ENV).to receive(:[]).with('TDDIUM_TID').and_return(service_job_number)
|
361
|
+
allow(ENV).to receive(:[]).with('TDDIUM_PR_ID').and_return(service_pull_request)
|
362
|
+
allow(ENV).to receive(:[]).with('TDDIUM_CURRENT_BRANCH').and_return(service_branch)
|
312
363
|
end
|
313
364
|
|
314
|
-
it '
|
365
|
+
it 'sets the expected parameters' do
|
315
366
|
config = {}
|
316
|
-
|
317
|
-
config[:service_name].
|
318
|
-
config[:service_number].
|
319
|
-
config[:
|
320
|
-
config[:
|
321
|
-
config[:
|
367
|
+
described_class.set_service_params_for_tddium(config)
|
368
|
+
expect(config[:service_name]).to eq('tddium')
|
369
|
+
expect(config[:service_number]).to eq(service_number)
|
370
|
+
expect(config[:service_job_number]).to eq(service_job_number)
|
371
|
+
expect(config[:service_pull_request]).to eq(service_pull_request)
|
372
|
+
expect(config[:service_branch]).to eq(service_branch)
|
373
|
+
expect(config[:service_build_url]).to eq(format('https://ci.solanolabs.com/reports/%s', service_number))
|
322
374
|
end
|
323
375
|
end
|
324
376
|
|
@@ -342,14 +394,14 @@ describe Coveralls::Configuration do
|
|
342
394
|
end
|
343
395
|
|
344
396
|
it 'uses ENV vars' do
|
345
|
-
config =
|
346
|
-
config[:head][:id].
|
347
|
-
config[:head][:author_name].
|
348
|
-
config[:head][:author_email].
|
349
|
-
config[:head][:committer_name].
|
350
|
-
config[:head][:committer_email].
|
351
|
-
config[:head][:message].
|
352
|
-
config[:branch].
|
397
|
+
config = described_class.git
|
398
|
+
expect(config[:head][:id]).to eq(git_id)
|
399
|
+
expect(config[:head][:author_name]).to eq(author_name)
|
400
|
+
expect(config[:head][:author_email]).to eq(author_email)
|
401
|
+
expect(config[:head][:committer_name]).to eq(committer_name)
|
402
|
+
expect(config[:head][:committer_email]).to eq(committer_email)
|
403
|
+
expect(config[:head][:message]).to eq(message)
|
404
|
+
expect(config[:branch]).to eq(branch)
|
353
405
|
end
|
354
406
|
end
|
355
407
|
end
|