coveralls_reborn 0.9.0 → 0.10.0

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,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.stub(:[]).and_return(nil)
7
+ allow(ENV).to receive(:[]).and_return(nil)
6
8
  end
7
9
 
8
10
  describe '.configuration' do
9
- it "returns a hash with the default keys" do
10
- config = Coveralls::Configuration.configuration
11
- config.should be_a(Hash)
12
- config.keys.should include(:environment)
13
- config.keys.should include(:git)
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
- Coveralls::Configuration.stub(:yaml_config).and_return(yaml_config)
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 = Coveralls::Configuration.configuration
32
- config[:configuration].should eq(yaml_config)
33
- config[:repo_token].should eq(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 = Coveralls::Configuration.configuration
39
- config[:configuration].should eq(yaml_config)
40
- config[:repo_token].should eq(repo_secret_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.stub(:[]).with('COVERALLS_REPO_TOKEN').and_return(repo_token)
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 = Coveralls::Configuration.configuration
53
- config[:repo_token].should eq(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 'Services' do
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.stub(:[]).with('TRAVIS').and_return('1')
62
- ENV.stub(:[]).with('COVERALLS_SERVICE_NAME').and_return(service_name)
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 = Coveralls::Configuration.configuration
67
- config[:service_name].should eq(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 'on Travis' do
94
+ context 'when using Travis' do
72
95
  before do
73
- ENV.stub(:[]).with('TRAVIS').and_return('1')
96
+ allow(ENV).to receive(:[]).with('TRAVIS').and_return('1')
97
+ described_class.configuration
74
98
  end
75
99
 
76
- it 'should set service parameters for this service and no other' do
77
- Coveralls::Configuration.should_receive(:set_service_params_for_travis).with(anything, anything)
78
- Coveralls::Configuration.should_not_receive(:set_service_params_for_circleci)
79
- Coveralls::Configuration.should_not_receive(:set_service_params_for_semaphore)
80
- Coveralls::Configuration.should_not_receive(:set_service_params_for_jenkins)
81
- Coveralls::Configuration.should_not_receive(:set_service_params_for_coveralls_local)
82
- Coveralls::Configuration.should_receive(:set_standard_service_params_for_generic_ci)
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 'on CircleCI' do
110
+ context 'when using CircleCI' do
88
111
  before do
89
- ENV.stub(:[]).with('CIRCLECI').and_return('1')
112
+ allow(ENV).to receive(:[]).with('CIRCLECI').and_return('1')
113
+ described_class.configuration
90
114
  end
91
115
 
92
- it 'should set service parameters for this service and no other' do
93
- Coveralls::Configuration.should_not_receive(:set_service_params_for_travis)
94
- Coveralls::Configuration.should_receive(:set_service_params_for_circleci)
95
- Coveralls::Configuration.should_not_receive(:set_service_params_for_semaphore)
96
- Coveralls::Configuration.should_not_receive(:set_service_params_for_jenkins)
97
- Coveralls::Configuration.should_not_receive(:set_service_params_for_coveralls_local)
98
- Coveralls::Configuration.should_receive(:set_standard_service_params_for_generic_ci)
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 'on Semaphore' do
126
+ context 'when using Semaphore' do
104
127
  before do
105
- ENV.stub(:[]).with('SEMAPHORE').and_return('1')
128
+ allow(ENV).to receive(:[]).with('SEMAPHORE').and_return('1')
129
+ described_class.configuration
106
130
  end
107
131
 
108
- it 'should set service parameters for this service and no other' do
109
- Coveralls::Configuration.should_not_receive(:set_service_params_for_travis)
110
- Coveralls::Configuration.should_not_receive(:set_service_params_for_circleci)
111
- Coveralls::Configuration.should_receive(:set_service_params_for_semaphore)
112
- Coveralls::Configuration.should_not_receive(:set_service_params_for_jenkins)
113
- Coveralls::Configuration.should_not_receive(:set_service_params_for_coveralls_local)
114
- Coveralls::Configuration.should_receive(:set_standard_service_params_for_generic_ci)
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.stub(:[]).with('JENKINS_URL').and_return('1')
144
+ allow(ENV).to receive(:[]).with('JENKINS_URL').and_return('1')
145
+ described_class.configuration
122
146
  end
123
147
 
124
- it 'should set service parameters for this service and no other' do
125
- Coveralls::Configuration.should_not_receive(:set_service_params_for_travis)
126
- Coveralls::Configuration.should_not_receive(:set_service_params_for_circleci)
127
- Coveralls::Configuration.should_not_receive(:set_service_params_for_semaphore)
128
- Coveralls::Configuration.should_receive(:set_service_params_for_jenkins)
129
- Coveralls::Configuration.should_not_receive(:set_service_params_for_coveralls_local)
130
- Coveralls::Configuration.should_receive(:set_standard_service_params_for_generic_ci)
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.stub(:[]).with('COVERALLS_RUN_LOCALLY').and_return('1')
160
+ allow(ENV).to receive(:[]).with('COVERALLS_RUN_LOCALLY').and_return('1')
161
+ described_class.configuration
138
162
  end
139
163
 
140
- it 'should set service parameters for this service and no other' do
141
- Coveralls::Configuration.should_not_receive(:set_service_params_for_travis)
142
- Coveralls::Configuration.should_not_receive(:set_service_params_for_circleci)
143
- Coveralls::Configuration.should_not_receive(:set_service_params_for_semaphore)
144
- Coveralls::Configuration.should_not_receive(:set_service_params_for_jenkins)
145
- Coveralls::Configuration.should_receive(:set_service_params_for_coveralls_local)
146
- Coveralls::Configuration.should_receive(:set_standard_service_params_for_generic_ci)
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 'for generic CI' do
174
+ context 'when using a generic CI' do
152
175
  before do
153
- ENV.stub(:[]).with('CI_NAME').and_return('1')
176
+ allow(ENV).to receive(:[]).with('CI_NAME').and_return('1')
177
+ described_class.configuration
154
178
  end
155
179
 
156
- it 'should set service parameters for this service and no other' do
157
- Coveralls::Configuration.should_not_receive(:set_service_params_for_travis)
158
- Coveralls::Configuration.should_not_receive(:set_service_params_for_circleci)
159
- Coveralls::Configuration.should_not_receive(:set_service_params_for_semaphore)
160
- Coveralls::Configuration.should_not_receive(:set_service_params_for_jenkins)
161
- Coveralls::Configuration.should_not_receive(:set_service_params_for_coveralls_local)
162
- Coveralls::Configuration.should_receive(:set_standard_service_params_for_generic_ci).with(anything)
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.stub(:[]).with('TRAVIS_JOB_ID').and_return(travis_job_id)
196
+ allow(ENV).to receive(:[]).with('TRAVIS_JOB_ID').and_return(travis_job_id)
173
197
  end
174
198
 
175
- it 'should set the service_job_id' do
199
+ it 'sets the service_job_id' do
176
200
  config = {}
177
- Coveralls::Configuration.set_service_params_for_travis(config, nil)
178
- config[:service_job_id].should eq(travis_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 'should set the service_name to travis-ci by default' do
205
+ it 'sets the service_name to travis-ci by default' do
182
206
  config = {}
183
- Coveralls::Configuration.set_service_params_for_travis(config, nil)
184
- config[:service_name].should eq('travis-ci')
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 'should set the service_name to a value if one is passed in' do
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
- Coveralls::Configuration.set_service_params_for_travis(config, random_name)
191
- config[:service_name].should eq(random_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.stub(:[]).with('CIRCLE_BUILD_NUM').and_return(circle_build_num)
223
+ allow(ENV).to receive(:[]).with('CIRCLE_BUILD_NUM').and_return(circle_build_num)
199
224
  end
200
225
 
201
- it 'should set the expected parameters' do
226
+ it 'sets the expected parameters' do
202
227
  config = {}
203
- Coveralls::Configuration.set_service_params_for_circleci(config)
204
- config[:service_name].should eq('circleci')
205
- config[:service_number].should eq(circle_build_num)
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) { "spec:one" }
236
+ let(:service_job_number) { 'spec:one' }
212
237
  let(:service_job_id) { 1234 }
213
- let(:service_branch) { "feature" }
238
+ let(:service_branch) { 'feature' }
214
239
 
215
240
  before do
216
- ENV.stub(:[]).with('CI_BUILD_NAME').and_return(service_job_number)
217
- ENV.stub(:[]).with('CI_BUILD_ID').and_return(service_job_id)
218
- ENV.stub(:[]).with('CI_BUILD_REF_NAME').and_return(service_branch)
219
- ENV.stub(:[]).with('CI_BUILD_REF').and_return(commit_sha)
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 'should set the expected parameters' do
247
+ it 'sets the expected parameters' do
223
248
  config = {}
224
- Coveralls::Configuration.set_service_params_for_gitlab(config)
225
- config[:service_name].should eq('gitlab-ci')
226
- config[:service_job_number].should eq(service_job_number)
227
- config[:service_job_id].should eq(service_job_id)
228
- config[:service_branch].should eq(service_branch)
229
- config[:commit_sha].should eq(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.stub(:[]).with('SEMAPHORE_BUILD_NUMBER').and_return(semaphore_build_num)
262
+ allow(ENV).to receive(:[]).with('SEMAPHORE_BUILD_NUMBER').and_return(semaphore_build_num)
237
263
  end
238
264
 
239
- it 'should set the expected parameters' do
265
+ it 'sets the expected parameters' do
240
266
  config = {}
241
- Coveralls::Configuration.set_service_params_for_semaphore(config)
242
- config[:service_name].should eq('semaphore')
243
- config[:service_number].should eq(semaphore_build_num)
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.stub(:[]).with('CI_PULL_REQUEST').and_return(service_pull_request)
252
- ENV.stub(:[]).with('BUILD_NUMBER').and_return(build_num)
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 'should set the expected parameters' do
282
+ it 'sets the expected parameters' do
256
283
  config = {}
257
- Coveralls::Configuration.set_service_params_for_jenkins(config)
258
- Coveralls::Configuration.set_standard_service_params_for_generic_ci(config)
259
- config[:service_name].should eq('jenkins')
260
- config[:service_number].should eq(build_num)
261
- config[:service_pull_request].should eq(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 'should set the expected parameters' do
293
+ it 'sets the expected parameters' do
267
294
  config = {}
268
- Coveralls::Configuration.set_service_params_for_coveralls_local(config)
269
- config[:service_name].should eq('coveralls-ruby')
270
- config[:service_job_id].should be_nil
271
- config[:service_event_type].should eq('manual')
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.stub(:[]).with('CI_NAME').and_return(service_name)
284
- ENV.stub(:[]).with('CI_BUILD_NUMBER').and_return(service_number)
285
- ENV.stub(:[]).with('CI_BUILD_URL').and_return(service_build_url)
286
- ENV.stub(:[]).with('CI_BRANCH').and_return(service_branch)
287
- ENV.stub(:[]).with('CI_PULL_REQUEST').and_return(service_pull_request)
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 'should set the expected parameters' do
317
+ it 'sets the expected parameters' do
291
318
  config = {}
292
- Coveralls::Configuration.set_standard_service_params_for_generic_ci(config)
293
- config[:service_name].should eq(service_name)
294
- config[:service_number].should eq(service_number)
295
- config[:service_build_url].should eq(service_build_url)
296
- config[:service_branch].should eq(service_branch)
297
- config[:service_pull_request].should eq(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.stub(:[]).with('APPVEYOR_BUILD_VERSION').and_return(service_number)
309
- ENV.stub(:[]).with('APPVEYOR_REPO_BRANCH').and_return(service_branch)
310
- ENV.stub(:[]).with('APPVEYOR_REPO_COMMIT').and_return(commit_sha)
311
- ENV.stub(:[]).with('APPVEYOR_REPO_NAME').and_return(repo_name)
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 'should set the expected parameters' do
365
+ it 'sets the expected parameters' do
315
366
  config = {}
316
- Coveralls::Configuration.set_service_params_for_appveyor(config)
317
- config[:service_name].should eq('appveyor')
318
- config[:service_number].should eq(service_number)
319
- config[:service_branch].should eq(service_branch)
320
- config[:commit_sha].should eq(commit_sha)
321
- config[:service_build_url].should eq('https://ci.appveyor.com/project/%s/build/%s' % [repo_name, service_number])
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 = Coveralls::Configuration.git
346
- config[:head][:id].should eq(git_id)
347
- config[:head][:author_name].should eq(author_name)
348
- config[:head][:author_email].should eq(author_email)
349
- config[:head][:committer_name].should eq(committer_name)
350
- config[:head][:committer_email].should eq(committer_email)
351
- config[:head][:message].should eq(message)
352
- config[:branch].should eq(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