Add test coverage

This commit is contained in:
Ethan Dennis
2023-05-15 12:32:37 -07:00
parent 0a01e3e141
commit b0e1adc47c
2 changed files with 17 additions and 10 deletions
+13 -5
View File
@@ -54,8 +54,8 @@ RSpec.describe Arguments do
let(:output) { ["--option", "value"] }
it "writes an output variable" do
expect(arguments).to receive(:set_output).with("args", "--option $variable_1")
expect(arguments).to receive(:set_environment).with("variable_684", "value")
expect(arguments).to receive(:set_output).with("args", /--option \$variable_\d{4}/)
expect(arguments).to receive(:set_environment).with(/variable_\d{4}/, "value")
subject
end
end
@@ -64,7 +64,8 @@ RSpec.describe Arguments do
let(:output) { ["--option", "some value"] }
it "writes an output variable" do
expect(arguments).to receive(:set_output).with("args", "--option \"some value\"")
expect(arguments).to receive(:set_output).with("args", /--option \$variable_\d{4}/)
expect(arguments).to receive(:set_environment).with(/variable_\d{4}/, "\"some value\"")
subject
end
end
@@ -74,7 +75,10 @@ RSpec.describe Arguments do
let(:options) { { "custom-transformers" => "transformers/**/*.rb" } }
it "writes an output variable" do
expect(arguments).to receive(:set_output).with("args", "--option value --custom-transformers transformers/**/*.rb")
expect(arguments).to receive(:set_output).with("args", /--option \$variable_\d{4} --custom-transformers \$variable_\d{4}/)
["value", "transformers/**/*.rb"].each do |value|
expect(arguments).to receive(:set_environment).with(/variable_\d{4}/, value)
end
subject
end
end
@@ -88,7 +92,11 @@ RSpec.describe Arguments do
end
it "writes an output variable" do
expect(arguments).to receive(:set_output).with("args", "--option value --custom-transformers transformers/jenkins/transformers.rb transformers/all.rb")
expect(arguments).to receive(:set_output).with("args", /--option \$variable_\d{4} --custom-transformers \$variable_\d{4} \$variable_\d{4}/)
["value", *files].each do |value|
expect(arguments).to receive(:set_environment).with(/variable_\d{4}/, value)
end
subject
end
end