From 1f7219b64e4f5989c69d3eeca3ac2f057826a8af Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 21 Nov 2024 15:47:40 +1100 Subject: [PATCH] fixing tests --- .../helper/ddg_apple_automation_helper.rb | 5 ++--- spec/ddg_apple_automation_helper_spec.rb | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/fastlane/plugin/ddg_apple_automation/helper/ddg_apple_automation_helper.rb b/lib/fastlane/plugin/ddg_apple_automation/helper/ddg_apple_automation_helper.rb index eb6ce63..b66cb2d 100644 --- a/lib/fastlane/plugin/ddg_apple_automation/helper/ddg_apple_automation_helper.rb +++ b/lib/fastlane/plugin/ddg_apple_automation/helper/ddg_apple_automation_helper.rb @@ -122,10 +122,11 @@ def self.current_version def self.prepare_release_branch(platform, version, other_action) code_freeze_prechecks(other_action) unless Helper.is_ci? new_version = validate_new_version(version) - release_branch_name = create_release_branch(new_version) + create_release_branch(new_version) update_embedded_files(platform, other_action) update_version_config(new_version, other_action) other_action.push_to_git_remote + release_branch_name = "#{RELEASE_BRANCH}/#{new_version}" Helper::GitHubActionsHelper.set_output("release_branch_name", release_branch_name) return release_branch_name, new_version @@ -200,8 +201,6 @@ def self.create_release_branch(version) # Create the branch and push Actions.sh('git', 'checkout', '-b', release_branch) Actions.sh('git', 'push', '-u', 'origin', release_branch) - - release_branch end def self.update_embedded_files(platform, other_action) diff --git a/spec/ddg_apple_automation_helper_spec.rb b/spec/ddg_apple_automation_helper_spec.rb index 46e6ae2..488f7d1 100644 --- a/spec/ddg_apple_automation_helper_spec.rb +++ b/spec/ddg_apple_automation_helper_spec.rb @@ -121,7 +121,7 @@ def load_file(file) it "prepares the release branch with version updates" do allow(Fastlane::Helper::DdgAppleAutomationHelper).to receive(:code_freeze_prechecks) allow(Fastlane::Helper::DdgAppleAutomationHelper).to receive(:validate_new_version).and_return(version) - allow(Fastlane::Helper::DdgAppleAutomationHelper).to receive(:create_release_branch).and_return("release/1.0.0") + allow(Fastlane::Helper::DdgAppleAutomationHelper).to receive(:create_release_branch) allow(Fastlane::Helper::DdgAppleAutomationHelper).to receive(:update_embedded_files) allow(Fastlane::Helper::DdgAppleAutomationHelper).to receive(:update_version_config) expect(other_action).to receive(:push_to_git_remote) @@ -148,6 +148,8 @@ def load_file(file) it "raises an error when the branch already exists" do allow(Fastlane::Actions).to receive(:sh).with("git", "branch", "--list", "hotfix/1.0.1").and_return("hotfix/1.0.1") + source_version = "1.0.0" + new_version = "1.0.1" expect do Fastlane::Helper::DdgAppleAutomationHelper.create_hotfix_branch(source_version, new_version) end.to raise_error(FastlaneCore::Interface::FastlaneCommonException, "Branch hotfix/1.0.1 already exists in this repository. Aborting.") @@ -173,7 +175,7 @@ def load_file(file) formatted_version = "1.0.0" allow(Fastlane::Helper::DdgAppleAutomationHelper).to receive(:format_version).with(version).and_return(formatted_version) allow(Fastlane::Actions).to receive(:sh).with("git", "fetch", "--tags") - allow(Fastlane::Helper::DdgAppleAutomationHelper).to receive(:sh).with("git", "tag", "--list", formatted_version).and_return(formatted_version) + allow(Fastlane::Actions).to receive(:sh).with("git", "tag", "--list", formatted_version).and_return(formatted_version) result = Fastlane::Helper::DdgAppleAutomationHelper.validate_version_exists(version) expect(result).to eq(formatted_version)