|
8 | 8 | shared_context "common setup" do |
9 | 9 | before do |
10 | 10 | allow(Octokit::Client).to receive(:new).and_return(client) |
| 11 | + allow(Fastlane::UI).to receive(:message) |
11 | 12 | allow(Fastlane::UI).to receive(:success) |
12 | 13 | allow(Fastlane::UI).to receive(:important) |
13 | 14 | end |
@@ -334,6 +335,53 @@ def validate_semver(version) |
334 | 335 | end |
335 | 336 | end |
336 | 337 |
|
| 338 | + describe "#freeze_release_branch" do |
| 339 | + subject { Fastlane::Helper::GitHelper.freeze_release_branch(platform, github_token, other_action) } |
| 340 | + let(:other_action) { double(set_github_release: nil) } |
| 341 | + let(:platform) { "ios" } |
| 342 | + let(:latest_release_name) { "1.0.0+ios" } |
| 343 | + let(:latest_marketing_version) { "1.0.1" } |
| 344 | + |
| 345 | + include_context "common setup" |
| 346 | + |
| 347 | + before do |
| 348 | + allow(Fastlane::Helper::GitHelper).to receive(:find_latest_marketing_version).and_return(latest_marketing_version) |
| 349 | + allow(Fastlane::Helper::GitHelper).to receive(:latest_release).and_return(double(name: latest_release_name)) |
| 350 | + allow(other_action).to receive(:set_github_release) |
| 351 | + end |
| 352 | + |
| 353 | + context "when the release branch is already frozen" do |
| 354 | + let(:latest_release_name) { "1.0.1+ios" } |
| 355 | + |
| 356 | + it "does not create a draft public release" do |
| 357 | + subject |
| 358 | + expect(other_action).not_to have_received(:set_github_release) |
| 359 | + end |
| 360 | + end |
| 361 | + |
| 362 | + context "when the release branch is not frozen" do |
| 363 | + it "creates a draft public release" do |
| 364 | + subject |
| 365 | + |
| 366 | + description = <<~DESCRIPTION |
| 367 | + This draft release is here to indicate that the release branch is frozen. |
| 368 | + New internal releases on `release/ios/1.0.1` branch cannot be created. |
| 369 | + If you need to bump the internal release, please manually delete this draft release. |
| 370 | + DESCRIPTION |
| 371 | + |
| 372 | + expect(other_action).to have_received(:set_github_release).with( |
| 373 | + api_bearer: github_token, |
| 374 | + description: description, |
| 375 | + is_draft: true, |
| 376 | + is_prerelease: false, |
| 377 | + name: "1.0.1+ios", |
| 378 | + repository_name: Fastlane::Helper::GitHelper.repo_name, |
| 379 | + tag_name: "" |
| 380 | + ) |
| 381 | + end |
| 382 | + end |
| 383 | + end |
| 384 | + |
337 | 385 | describe "#assert_branch_has_changes" do |
338 | 386 | subject { Fastlane::Helper::GitHelper.assert_branch_has_changes("release_branch", platform) } |
339 | 387 |
|
|
0 commit comments