Skip to content

Commit d1d2011

Browse files
authored
[codex] Add failing release asset specs (#745)
2 parents 572ec20 + 747d06f commit d1d2011

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

spec/github_helper_spec.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,39 @@ def create_release(is_draft:, assets: [], name: nil)
665665
end.to raise_error(FastlaneCore::Interface::FastlaneError, "Can't find file missing-file.zip!")
666666
end
667667

668+
it 'fails clearly if an asset is not a file path' do
669+
expect(client).not_to receive(:release_for_tag)
670+
expect(client).not_to receive(:release_assets)
671+
expect(client).not_to receive(:upload_asset)
672+
673+
expect do
674+
upload_release_assets(assets: [123])
675+
end.to raise_error(FastlaneCore::Interface::FastlaneError, 'release_assets must contain file paths')
676+
end
677+
678+
it 'fails without mutating GitHub when local assets have duplicate filenames' do
679+
in_tmp_dir do |tmpdir|
680+
first_dir = File.join(tmpdir, 'ios')
681+
second_dir = File.join(tmpdir, 'tvos')
682+
Dir.mkdir(first_dir)
683+
Dir.mkdir(second_dir)
684+
685+
first_file_path = File.join(first_dir, 'test-app.zip')
686+
second_file_path = File.join(second_dir, 'test-app.zip')
687+
File.write(first_file_path, 'ios')
688+
File.write(second_file_path, 'tvos')
689+
690+
expect(client).not_to receive(:release_for_tag)
691+
expect(client).not_to receive(:release_assets)
692+
expect(client).not_to receive(:delete_release_asset)
693+
expect(client).not_to receive(:upload_asset)
694+
695+
expect do
696+
upload_release_assets(assets: [first_file_path, second_file_path], replace_existing: false)
697+
end.to raise_error(FastlaneCore::Interface::FastlaneError, 'release_assets must not contain duplicate filenames')
698+
end
699+
end
700+
668701
it 'uploads one asset to the existing release' do
669702
with_tmp_file(named: 'test-app.zip') do |file_path|
670703
expect(client).to receive(:upload_asset).with(release_url, file_path, { content_type: 'application/octet-stream' })

0 commit comments

Comments
 (0)