Skip to content

Commit 21d935d

Browse files
committed
Add freeze_release_branch_action_spec
1 parent 08f8cf8 commit 21d935d

2 files changed

Lines changed: 41 additions & 2 deletions

File tree

lib/fastlane/plugin/ddg_apple_automation/actions/freeze_release_branch_action.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ module Fastlane
88
module Actions
99
class FreezeReleaseBranchAction < Action
1010
def self.run(params)
11-
github_token = params[:github_token]
1211
platform = params[:platform] || Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]
1312

1413
begin
15-
Helper::GitHelper.freeze_release_branch(platform, github_token, other_action)
14+
Helper::GitHelper.freeze_release_branch(platform, params[:github_token], other_action)
1615
rescue StandardError => e
1716
UI.important("Failed to create GitHub release")
1817
Helper::DdgAppleAutomationHelper.report_error(e)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
describe Fastlane::Actions::FreezeReleaseBranchAction do
2+
describe "#run" do
3+
subject do
4+
configuration = Fastlane::ConfigurationHelper.parse(Fastlane::Actions::FreezeReleaseBranchAction, params)
5+
Fastlane::Actions::FreezeReleaseBranchAction.run(configuration)
6+
end
7+
8+
let(:params) do
9+
{
10+
platform: "ios",
11+
github_token: "github-token"
12+
}
13+
end
14+
15+
before do
16+
allow(Fastlane::Helper::GitHelper).to receive(:freeze_release_branch)
17+
allow(Fastlane::UI).to receive(:important)
18+
allow(Fastlane::Helper::DdgAppleAutomationHelper).to receive(:report_error)
19+
end
20+
21+
it "calls helper" do
22+
subject
23+
expect(Fastlane::Helper::GitHelper).to have_received(:freeze_release_branch)
24+
expect(Fastlane::UI).not_to have_received(:important)
25+
expect(Fastlane::Helper::DdgAppleAutomationHelper).not_to have_received(:report_error)
26+
end
27+
28+
context "when helper fails" do
29+
before do
30+
allow(Fastlane::Helper::GitHelper).to receive(:freeze_release_branch).and_raise("error")
31+
end
32+
33+
it "reports error" do
34+
subject
35+
expect(Fastlane::UI).to have_received(:important)
36+
expect(Fastlane::Helper::DdgAppleAutomationHelper).to have_received(:report_error)
37+
end
38+
end
39+
end
40+
end

0 commit comments

Comments
 (0)