Skip to content

Commit

Permalink
Move load file func to helper
Browse files Browse the repository at this point in the history
  • Loading branch information
jaceklyp committed Sep 12, 2024
1 parent 61c5c6a commit 8683bc1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
8 changes: 0 additions & 8 deletions spec/asana_add_comment_action_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@
end
end

it "shows error if provided template does not exist" do
allow(File).to receive(:read).and_raise(Errno::ENOENT)
allow(Fastlane::Helper::DdgAppleAutomationHelper).to receive(:path_for_asset_file).and_return("non-existing.html")
expect(Fastlane::UI).to receive(:user_error!).with("Error: The file 'non-existing.html' does not exist.")
expect(@asana_client_stories).not_to receive(:create_story_for_task)
test_action(task_id: "123", template_name: "non-existing")
end

it "correctly builds html_text payload" do
allow(File).to receive(:read).and_return(" \nHello, \n World!\n This is a test. \n")
allow(@asana_client_stories).to receive(:create_story_for_task)
Expand Down
13 changes: 13 additions & 0 deletions spec/ddg_apple_automation_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ def asana_task_url(task_id)
end
end

describe "#load_file" do
it "shows error if provided file does not exist" do
allow(Fastlane::UI).to receive(:user_error!)
allow(File).to receive(:read).and_raise(Errno::ENOENT)
load_file("file")
expect(Fastlane::UI).to have_received(:user_error!).with("Error: The file 'file' does not exist.")
end

def load_file(file)
Fastlane::Helper::DdgAppleAutomationHelper.load_file(file)
end
end

describe "#sanitize_and_replace_env_vars" do
it "substitutes all env variables" do
content = "<h2>${ASSIGNEE_ID} is publishing ${TAG} hotfix release</h2>"
Expand Down

0 comments on commit 8683bc1

Please sign in to comment.