Skip to content

Commit

Permalink
Rename #secure_env_vars_removed? to #secure_env_removed?
Browse files Browse the repository at this point in the history
Shorter, and more consistent with a related property secure_env_enabled.
  • Loading branch information
BanzaiMan committed Mar 17, 2017
1 parent cce7c03 commit 8a694be
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/travis/scheduler/serialize/worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def job_data
pull_request: build.pull_request? ? build.pull_request_number : false,
state: job.state.to_s,
secure_env_enabled: job.secure_env?,
secure_env_vars_removed: job.secure_env_vars_removed?,
secure_env_removed: job.secure_env_removed?,
debug_options: job.debug_options || {},
queued_at: format_date(job.queued_at),
allow_failure: job.allow_failure,
Expand Down
2 changes: 1 addition & 1 deletion lib/travis/scheduler/serialize/worker/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def same_repo_pull_request?
request.same_repo_pull_request?
end

def secure_env_vars_removed?
def secure_env_removed?
!secure_env? &&
job.repository.settings.has_secure_vars? || [:env, :global_env].any? do |key|
config.key?(key) &&
Expand Down
10 changes: 5 additions & 5 deletions spec/travis/scheduler/serialize/worker/job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,31 @@
end
end

describe '#secure_env_vars_removed?' do
describe '#secure_env_removed?' do
describe 'with a push event' do
before { build.event_type = 'push' }
it { expect(subject.secure_env_vars_removed?).to eq(false) }
it { expect(subject.secure_env_removed?).to eq(false) }
end

describe 'with a pull_request event' do
before { build.event_type = 'pull_request' }

describe 'from the same repository' do
before { request.stubs(:same_repo_pull_request?).returns(true) }
it { expect(subject.secure_env_vars_removed?).to eq(false) }
it { expect(subject.secure_env_removed?).to eq(false) }
end

describe 'from a different repository' do
before { request.stubs(:same_repo_pull_request?).returns(false) }

context "when .travis.yml defines a secure var" do
let(:config) { { env: { secure: "secret" } } }
it { expect(subject.secure_env_vars_removed?).to eq(true) }
it { expect(subject.secure_env_removed?).to eq(true) }
end

context "when repository settings define a secure var" do
before { repository.settings.stubs(:has_secure_vars?).returns(true) }
it { expect(subject.secure_env_vars_removed?).to eq(true) }
it { expect(subject.secure_env_removed?).to eq(true) }
end
end

Expand Down
6 changes: 3 additions & 3 deletions spec/travis/scheduler/serialize/worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def encrypted(value)
pull_request: false,
state: 'queued',
secure_env_enabled: true,
secure_env_vars_removed: false,
secure_env_removed: false,
debug_options: {},
queued_at: '2016-01-01T10:30:00Z',
allow_failure: allow_failure
Expand Down Expand Up @@ -123,7 +123,7 @@ def encrypted(value)
pull_request: false,
state: 'queued',
secure_env_enabled: true,
secure_env_vars_removed: false,
secure_env_removed: false,
debug_options: {},
queued_at: '2016-01-01T10:30:00Z',
allow_failure: false,
Expand Down Expand Up @@ -215,7 +215,7 @@ def encrypted(value)
pull_request: 180,
state: 'queued',
secure_env_enabled: false,
secure_env_vars_removed: true,
secure_env_removed: true,
debug_options: {},
queued_at: '2016-01-01T10:30:00Z',
pull_request_head_branch: 'head_branch',
Expand Down

0 comments on commit 8a694be

Please sign in to comment.