Skip to content

Commit 84816fc

Browse files
committed
Update tests
i#Fix
1 parent 97f225f commit 84816fc

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ def initialize(params = {})
1010
end
1111

1212
def source_contents
13-
return File.read(secrets_repository_file_path) unless (self.encrypt || ENV.key?('CIRCLECI'))
13+
# TODO: This works only on CircleCI. I chose this variable because it's the one checked by Fastlane::is_ci.
14+
# Fastlane::is_ci doesn't work here, so reimplementing the code has been necessary.
15+
# (This should be updated if we change CI or if fastlane is updated.)
16+
return File.read(secrets_repository_file_path) unless (self.encrypt || ENV.key?('CIRCLECI'))
1417
return nil unless File.file?(encrypted_file_path)
1518
encrypted = File.read(encrypted_file_path)
1619
Fastlane::Helper::EncryptionHelper.decrypt(encrypted, encryption_key)

spec/file_reference_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
end
6262
end
6363

64-
describe '#source_contents_on_ci' do
64+
describe '#source_contents on ci' do
6565
it 'gets the contents from the secrets repo' do
6666
set_circle_env(true) do
6767
allow(File).to receive(:read).with(subject.secrets_repository_file_path).and_return('source contents')

spec/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def set_circle_env(define_ci)
3030
is_ci = ENV.key?('CIRCLECI')
3131
orig_circle_ci = ENV['CIRCLECI']
3232
if (define_ci)
33-
ENV['CIRCLECI'] = 'CircleCI'
33+
ENV['CIRCLECI'] = "true"
3434
else
3535
ENV.delete 'CIRCLECI'
3636
end

0 commit comments

Comments
 (0)