-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathgithub_workflows_spec.rb
More file actions
59 lines (49 loc) · 1.72 KB
/
Copy pathgithub_workflows_spec.rb
File metadata and controls
59 lines (49 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# frozen_string_literal: true
require "spec_helper"
require "yaml"
RSpec.describe "GitHub workflow definitions" do # rubocop:disable RSpec/DescribeClass
describe "Delete Review App workflow" do
let(:workflow) do
YAML.safe_load_file(
File.expand_path("../.github/workflows/cpflow-delete-review-app.yml", __dir__),
aliases: true
)
end
let(:steps) { workflow.fetch("jobs").fetch("delete-review-app").fetch("steps") }
def step_named(name)
steps.find { |step| step["name"] == name }
end
it "runs cpflow delete from a downstream app checkout" do
expect(step_named("Checkout repository")).to include(
"uses" => "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd",
"with" => include(
"path" => "app",
"persist-credentials" => false
)
)
expect(step_named("Setup environment").fetch("with")).to include(
"working_directory" => "app"
)
expect(step_named("Delete review app").fetch("with")).to include(
"working_directory" => "app"
)
end
end
describe "Delete Control Plane App action" do
let(:action) do
YAML.safe_load_file(
File.expand_path("../.github/actions/cpflow-delete-control-plane-app/action.yml", __dir__),
aliases: true
)
end
it "allows callers to choose the project working directory" do
expect(action.fetch("inputs")).to include(
"working_directory" => include("default" => ".")
)
delete_step = action.fetch("runs").fetch("steps").find { |step| step["name"] == "Delete application" }
expect(delete_step).to include(
"working-directory" => "${{ inputs.working_directory }}"
)
end
end
end