|
18 | 18 | expect(described_class.get_from_env!(key: key)).to eq('abc123') |
19 | 19 | end |
20 | 20 | end |
| 21 | + |
| 22 | + describe '#commit_version_bump' do |
| 23 | + before do |
| 24 | + allow(described_class).to receive(:get_from_env!).and_return('') |
| 25 | + end |
| 26 | + |
| 27 | + it 'commits and pushes the app version bump with deliver file and metadata' do |
| 28 | + expect(Fastlane::Helper::GitHelper).to receive(:commit) do |arg| |
| 29 | + expect_commited_files(files: arg[:files], names: %w[config Deliverfile Resources download_metadata.swift]) |
| 30 | + end |
| 31 | + |
| 32 | + described_class.commit_version_bump() |
| 33 | + end |
| 34 | + |
| 35 | + it 'commits and pushes the app version bump with deliver file only' do |
| 36 | + expect(Fastlane::Helper::GitHelper).to receive(:commit) do |arg| |
| 37 | + expect_commited_files(files: arg[:files], names: %w[config Deliverfile]) |
| 38 | + end |
| 39 | + |
| 40 | + described_class.commit_version_bump(include_metadata: false) |
| 41 | + end |
| 42 | + |
| 43 | + it 'commits and pushes the app version bump with metadata only' do |
| 44 | + expect(Fastlane::Helper::GitHelper).to receive(:commit) do |arg| |
| 45 | + expect_commited_files(files: arg[:files], names: %w[config Resources download_metadata.swift]) |
| 46 | + end |
| 47 | + |
| 48 | + described_class.commit_version_bump(include_deliverfile: false) |
| 49 | + end |
| 50 | + |
| 51 | + it 'commits and pushes the app version bump config files only, no deliver file or metadata' do |
| 52 | + expect(Fastlane::Helper::GitHelper).to receive(:commit) do |arg| |
| 53 | + expect_commited_files(files: arg[:files], names: %w[config]) |
| 54 | + end |
| 55 | + |
| 56 | + described_class.commit_version_bump(include_metadata: false, include_deliverfile: false) |
| 57 | + end |
| 58 | + |
| 59 | + def expect_commited_files(files:, names:) |
| 60 | + expect(files.size).to be names.size |
| 61 | + expect(files.all? { |file| names.any? { |name| file.include? name } }).to be true |
| 62 | + end |
| 63 | + end |
21 | 64 | end |
0 commit comments