-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
161 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
lib/fastlane/plugin/ddg_apple_automation/actions/asana_find_release_task_action.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module Fastlane | ||
module DdgAppleAutomation | ||
VERSION = "0.8.0" | ||
VERSION = "0.8.1" | ||
end | ||
end |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
describe Fastlane::Actions::AsanaExtractTaskAssigneeAction do | ||
describe "#run" do | ||
before do | ||
@asana_client_tasks = double | ||
asana_client = double("asana_client") | ||
allow(Asana::Client).to receive(:new).and_return(asana_client) | ||
allow(asana_client).to receive(:tasks).and_return(@asana_client_tasks) | ||
allow(@asana_client_tasks).to receive(:get_task) | ||
end | ||
|
||
it "returns the assignee ID and sets GHA output when Asana task is assigned" do | ||
allow(Fastlane::Helper::GitHubActionsHelper).to receive(:set_output) | ||
expect(@asana_client_tasks).to receive(:get_task).and_return( | ||
double(assignee: { "gid" => "67890" }) | ||
) | ||
|
||
expect(test_action("12345")).to eq("67890") | ||
expect(Fastlane::Helper::GitHubActionsHelper).to have_received(:set_output).with("asana_assignee_id", "67890") | ||
end | ||
|
||
it "returns nil when Asana task is not assigned" do | ||
expect(@asana_client_tasks).to receive(:get_task).and_return( | ||
double(assignee: { "gid" => nil }) | ||
) | ||
|
||
expect(test_action("12345")).to eq(nil) | ||
end | ||
|
||
it "shows error when failed to fetch task assignee" do | ||
expect(@asana_client_tasks).to receive(:get_task).and_raise(StandardError, "API error") | ||
expect(Fastlane::UI).to receive(:user_error!).with("Failed to fetch task assignee: API error") | ||
|
||
test_action("12345") | ||
end | ||
end | ||
|
||
def test_action(task_id) | ||
Fastlane::Actions::AsanaExtractTaskAssigneeAction.run(task_id: task_id) | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
spec/asana_get_release_automation_subtask_id_action_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
describe Fastlane::Actions::AsanaGetReleaseAutomationSubtaskIdAction do | ||
describe "#run" do | ||
before do | ||
@asana_client_tasks = double | ||
asana_client = double("asana_client") | ||
allow(Asana::Client).to receive(:new).and_return(asana_client) | ||
allow(asana_client).to receive(:tasks).and_return(@asana_client_tasks) | ||
allow(@asana_client_tasks).to receive(:get_subtasks_for_task) | ||
end | ||
it "returns the 'Automation' subtask ID and sets GHA output when the subtask exists in the Asana task" do | ||
allow(Fastlane::Helper::GitHubActionsHelper).to receive(:set_output) | ||
expect(Fastlane::Actions::AsanaExtractTaskAssigneeAction).to receive(:run) | ||
expect(@asana_client_tasks).to receive(:get_subtasks_for_task).and_return( | ||
[double(gid: "12345", name: "Automation", created_at: "2020-01-01T00:00:00.000Z")] | ||
) | ||
|
||
expect(test_action("https://app.asana.com/0/0/0")).to eq("12345") | ||
expect(Fastlane::Helper::GitHubActionsHelper).to have_received(:set_output).with("asana_automation_task_id", "12345") | ||
end | ||
|
||
it "returns the oldest 'Automation' subtask when there are multiple subtasks with that name" do | ||
expect(Fastlane::Actions::AsanaExtractTaskAssigneeAction).to receive(:run) | ||
expect(@asana_client_tasks).to receive(:get_subtasks_for_task).and_return( | ||
[double(gid: "12345", name: "Automation", created_at: "2020-01-01T00:00:00.000Z"), | ||
double(gid: "431", name: "Automation", created_at: "2019-01-01T00:00:00.000Z"), | ||
double(gid: "12460", name: "Automation", created_at: "2020-01-05T00:00:00.000Z")] | ||
) | ||
|
||
expect(test_action("https://app.asana.com/0/0/0")).to eq("431") | ||
end | ||
|
||
it "returns nil when 'Automation' subtask does not exist in the Asana task" do | ||
allow(Fastlane::UI).to receive(:user_error!) | ||
expect(Fastlane::Actions::AsanaExtractTaskAssigneeAction).to receive(:run) | ||
expect(@asana_client_tasks).to receive(:get_subtasks_for_task).and_raise(StandardError, "API error") | ||
|
||
test_action("https://app.asana.com/0/0/0") | ||
expect(Fastlane::UI).to have_received(:user_error!).with("Failed to fetch 'Automation' subtasks for task 0: API error") | ||
end | ||
end | ||
|
||
def test_action(task_url) | ||
Fastlane::Actions::AsanaGetReleaseAutomationSubtaskIdAction.run(task_url: task_url) | ||
end | ||
end |
Oops, something went wrong.