Skip to content

Commit 32d3d8e

Browse files
committed
Add basic unit tests for Action ios_bump_version_release
1 parent 4eb66bd commit 32d3d8e

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

spec/ios_bump_version_release_spec.rb

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
require 'spec_helper'
2+
3+
describe Fastlane::Actions::IosBumpVersionReleaseAction do
4+
let(:default_branch) { 'my_new_branch' }
5+
let(:ensure_git_action_instance) { double() }
6+
let(:versions) { ['6.30'] }
7+
let(:next_version) { '6.31.0.0' }
8+
let(:next_version_short) { '6.31' }
9+
10+
describe 'creates the release branch, bumps the app version and commits the changes' do
11+
before do
12+
allow(Fastlane::Action).to receive(:other_action).and_return(ensure_git_action_instance)
13+
allow(ensure_git_action_instance).to receive(:ensure_git_branch).with(branch: default_branch)
14+
15+
allow(Fastlane::Helper::GitHelper).to receive(:checkout_and_pull).with(default_branch)
16+
allow(Fastlane::Helper::GitHelper).to receive(:create_branch).with("release/#{next_version_short}", from: default_branch)
17+
18+
allow(Fastlane::Helper::Ios::VersionHelper).to receive(:get_version_strings).and_return(versions)
19+
allow(Fastlane::Helper::Ios::VersionHelper).to receive(:update_xc_configs).with(next_version, next_version_short, nil)
20+
end
21+
22+
it 'does the fastlane deliver update' do
23+
skip_deliver = false
24+
25+
expect(Fastlane::Helper::Ios::VersionHelper).to receive(:update_fastlane_deliver).with(next_version_short)
26+
expect(Fastlane::Helper::Ios::GitHelper).to receive(:commit_version_bump).with(include_deliverfile: !skip_deliver, include_metadata: false)
27+
28+
run_described_fastlane_action(
29+
skip_deliver: skip_deliver,
30+
default_branch: default_branch
31+
)
32+
end
33+
34+
it 'skips the fastlane deliver update properly' do
35+
skip_deliver = true
36+
37+
expect(Fastlane::Helper::Ios::VersionHelper).not_to receive(:update_fastlane_deliver)
38+
expect(Fastlane::Helper::Ios::GitHelper).to receive(:commit_version_bump).with(include_deliverfile: !skip_deliver, include_metadata: false)
39+
40+
run_described_fastlane_action(
41+
skip_deliver: skip_deliver,
42+
default_branch: default_branch
43+
)
44+
end
45+
end
46+
end

0 commit comments

Comments
 (0)