Skip to content

Commit c9b3735

Browse files
committed
Improving the way env is being checked
1 parent abe63b5 commit c9b3735

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

lib/travis/api/enqueue/services/restart_model.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def accept?
3232

3333
def billing?
3434
# there is no billing for .org
35-
return true if ENV["TRAVIS_SITE"] == 'org'
35+
return true if Travis.config.org?
3636

3737
@_billing_ok ||= begin
3838
jobs = target.is_a?(Job) ? [target] : target.matrix

spec/lib/travis/api/enqueue/services/restart_model_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
before do
1111
Travis.config.billing.url = 'http://localhost:9292/'
1212
Travis.config.billing.auth_key = 'secret'
13-
ENV['TRAVIS_SITE'] = 'com'
1413
end
1514

1615
after do

spec/v3/services/job/restart_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@
238238
stub_request(:post, /http:\/\/localhost:9292\/(users|organizations)\/(.+)\/authorize_build/).to_return(
239239
body: MultiJson.dump(error: 'Plan not found'), status: 404
240240
)
241+
Travis.config.host = 'travis-ci.com'
241242
end
242243

243244
it 'restarts the job' do
@@ -251,6 +252,7 @@
251252
stub_request(:post, /http:\/\/localhost:9292\/(users|organizations)\/(.+)\/authorize_build/).to_return(
252253
body: MultiJson.dump(allowed: false, rejection_code: :no_build_credits), status: 403
253254
)
255+
Travis.config.host = 'travis-ci.com'
254256
end
255257

256258
it 'does not restart the job' do

0 commit comments

Comments
 (0)