Avoid magic prefix parsing
This commit is contained in:
@@ -51,7 +51,7 @@ RSpec.describe Arguments do
|
||||
end
|
||||
|
||||
context "when the output is not nil" do
|
||||
let(:output) { ["--option", "value"] }
|
||||
let(:output) { [["--option", "value"]] }
|
||||
|
||||
it "writes an output variable" do
|
||||
expect(arguments).to receive(:set_output).with("args", /--option \$variable_\d{4}/)
|
||||
@@ -61,7 +61,7 @@ RSpec.describe Arguments do
|
||||
end
|
||||
|
||||
context "when the output contains a space" do
|
||||
let(:output) { ["--option", "some value"] }
|
||||
let(:output) { [["--option", "some value"]] }
|
||||
|
||||
it "writes an output variable" do
|
||||
expect(arguments).to receive(:set_output).with("args", /--option \$variable_\d{4}/)
|
||||
@@ -71,7 +71,7 @@ RSpec.describe Arguments do
|
||||
end
|
||||
|
||||
context "when there is a custom transformers option" do
|
||||
let(:output) { ["--option", "value"] }
|
||||
let(:output) { [["--option", "value"]] }
|
||||
let(:options) { { "custom-transformers" => "transformers/**/*.rb" } }
|
||||
|
||||
it "writes an output variable" do
|
||||
@@ -84,7 +84,7 @@ RSpec.describe Arguments do
|
||||
end
|
||||
|
||||
context "when there are custom transformers in the repository" do
|
||||
let(:output) { ["--option", "value"] }
|
||||
let(:output) { [["--option", "value"]] }
|
||||
let(:files) { ["transformers/jenkins/transformers.rb", "transformers/all.rb"] }
|
||||
|
||||
before do
|
||||
|
||||
@@ -25,7 +25,7 @@ RSpec.describe AzureDevops::Audit do
|
||||
ISSUE
|
||||
end
|
||||
|
||||
it { is_expected.to eq(["--azure-devops-organization", "my-organization"]) }
|
||||
it { is_expected.to eq([["--azure-devops-organization", "my-organization"]]) }
|
||||
end
|
||||
|
||||
context "when issue_content contains a project" do
|
||||
@@ -36,7 +36,7 @@ RSpec.describe AzureDevops::Audit do
|
||||
ISSUE
|
||||
end
|
||||
|
||||
it { is_expected.to eq(["--azure-devops-organization", "my-organization", "--azure-devops-project", "my-project"]) }
|
||||
it { is_expected.to eq([["--azure-devops-organization", "my-organization"], ["--azure-devops-project", "my-project"]]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,13 +16,13 @@ RSpec.describe AzureDevops::DryRun do
|
||||
context "when the comment body does not contain a pipeline type" do
|
||||
let(:comment_body) { "/dry-run" }
|
||||
|
||||
it { is_expected.to eq(["pipeline", "--azure-devops-organization", "my-organization", "--azure-devops-project", "my-project"]) }
|
||||
it { is_expected.to eq(["pipeline", ["--azure-devops-organization", "my-organization"], ["--azure-devops-project", "my-project"]]) }
|
||||
end
|
||||
|
||||
context "when the comment body contains a pipeline id" do
|
||||
let(:comment_body) { "/dry-run --pipeline-id 42" }
|
||||
|
||||
it { is_expected.to eq(["pipeline", "--azure-devops-organization", "my-organization", "--azure-devops-project", "my-project", "--pipeline-id", "42"]) }
|
||||
it { is_expected.to eq(["pipeline", ["--azure-devops-organization", "my-organization"], ["--azure-devops-project", "my-project"], ["--pipeline-id", "42"]]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,13 +16,13 @@ RSpec.describe AzureDevops::Migrate do
|
||||
context "when the comment body does not contain a pipeline type" do
|
||||
let(:comment_body) { "/migrate" }
|
||||
|
||||
it { is_expected.to eq(["pipeline", "--azure-devops-organization", "my-organization", "--azure-devops-project", "my-project"]) }
|
||||
it { is_expected.to eq(["pipeline", ["--azure-devops-organization", "my-organization"], ["--azure-devops-project", "my-project"]]) }
|
||||
end
|
||||
|
||||
context "when the comment body contains a pipeline id" do
|
||||
let(:comment_body) { "/migrate --pipeline-id 42 --target-url https://github.com/org/repo" }
|
||||
|
||||
it { is_expected.to eq(["pipeline", "--azure-devops-organization", "my-organization", "--azure-devops-project", "my-project", "--pipeline-id", "42", "--target-url", "https://github.com/org/repo"]) }
|
||||
it { is_expected.to eq(["pipeline", ["--azure-devops-organization", "my-organization"], ["--azure-devops-project", "my-project"], ["--pipeline-id", "42"], ["--target-url", "https://github.com/org/repo"]]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,7 +23,7 @@ RSpec.describe CircleCI::Audit do
|
||||
ISSUE
|
||||
end
|
||||
|
||||
it { is_expected.to eq(["--circle-ci-organization", "testing"]) }
|
||||
it { is_expected.to eq([["--circle-ci-organization", "testing"]]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ RSpec.describe CircleCI::DryRun do
|
||||
context "when the comment body contains a project" do
|
||||
let(:comment_body) { "/dry-run --project repo" }
|
||||
|
||||
it { is_expected.to eq(["--circle-ci-organization", "testing", "--circle-ci-project", "repo"]) }
|
||||
it { is_expected.to eq([["--circle-ci-organization", "testing"], ["--circle-ci-project", "repo"]]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ RSpec.describe CircleCI::Migrate do
|
||||
context "when the comment body contains a project" do
|
||||
let(:comment_body) { "/migrate --project repo --target-url https://github.com/org/repo" }
|
||||
|
||||
it { is_expected.to eq(["--circle-ci-organization", "testing", "--circle-ci-project", "repo", "--target-url", "https://github.com/org/repo"]) }
|
||||
it { is_expected.to eq([["--circle-ci-organization", "testing"], ["--circle-ci-project", "repo"], ["--target-url", "https://github.com/org/repo"]]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,7 +23,7 @@ RSpec.describe GitlabCI::Audit do
|
||||
ISSUE
|
||||
end
|
||||
|
||||
it { is_expected.to eq(["--namespace", "testing"]) }
|
||||
it { is_expected.to eq([["--namespace", "testing"]]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ RSpec.describe GitlabCI::DryRun do
|
||||
context "when the comment body contains a pipeline id" do
|
||||
let(:comment_body) { "/dry-run --project project" }
|
||||
|
||||
it { is_expected.to eq(["--namespace", "testing", "--project", "project"]) }
|
||||
it { is_expected.to eq([["--namespace", "testing"], ["--project", "project"]]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ RSpec.describe GitlabCI::Migrate do
|
||||
context "when the comment body contains a pipeline id" do
|
||||
let(:comment_body) { "/migrate --project project --target-url https://github.com/org/repo" }
|
||||
|
||||
it { is_expected.to eq(["--namespace", "testing", "--project", "project", "--target-url", "https://github.com/org/repo"]) }
|
||||
it { is_expected.to eq([["--namespace", "testing"], ["--project", "project"], ["--target-url", "https://github.com/org/repo"]]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,7 +23,7 @@ RSpec.describe Jenkins::Audit do
|
||||
ISSUE
|
||||
end
|
||||
|
||||
it { is_expected.to eq(["--folders", "test, prod"]) }
|
||||
it { is_expected.to eq([["--folders", "test, prod"]]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,7 +10,7 @@ RSpec.describe Jenkins::DryRun do
|
||||
context "when the comment body contains a pipeline id" do
|
||||
let(:comment_body) { "/dry-run --source-url https://jenkins.company.com/job/pipeline" }
|
||||
|
||||
it { is_expected.to eq(["--source-url", "https://jenkins.company.com/job/pipeline"]) }
|
||||
it { is_expected.to eq([["--source-url", "https://jenkins.company.com/job/pipeline"]]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,7 +10,7 @@ RSpec.describe Jenkins::Migrate do
|
||||
context "when the comment body contains a pipeline id" do
|
||||
let(:comment_body) { "/migrate --source-url https://jenkins.company.com/job/pipeline --target-url https://github.com/org/repo" }
|
||||
|
||||
it { is_expected.to eq(["--source-url", "https://jenkins.company.com/job/pipeline", "--target-url", "https://github.com/org/repo"]) }
|
||||
it { is_expected.to eq([["--source-url", "https://jenkins.company.com/job/pipeline"], ["--target-url", "https://github.com/org/repo"]]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,7 +23,7 @@ RSpec.describe TravisCI::Audit do
|
||||
ISSUE
|
||||
end
|
||||
|
||||
it { is_expected.to eq(["--travis-ci-organization", "testing"]) }
|
||||
it { is_expected.to eq([["--travis-ci-organization", "testing"]]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ RSpec.describe TravisCI::DryRun do
|
||||
context "when the comment body contains a pipeline id" do
|
||||
let(:comment_body) { "/dry-run --repository repo" }
|
||||
|
||||
it { is_expected.to eq(["--travis-ci-organization", "testing", "--travis-ci-repository", "repo"]) }
|
||||
it { is_expected.to eq([["--travis-ci-organization", "testing"], ["--travis-ci-repository", "repo"]]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ RSpec.describe TravisCI::Migrate do
|
||||
context "when the comment body contains a pipeline id" do
|
||||
let(:comment_body) { "/migrate --repository repo --target-url https://github.com/org/repo" }
|
||||
|
||||
it { is_expected.to eq(["--travis-ci-organization", "testing", "--travis-ci-repository", "repo", "--target-url", "https://github.com/org/repo"]) }
|
||||
it { is_expected.to eq([["--travis-ci-organization", "testing"], ["--travis-ci-repository", "repo"], ["--target-url", "https://github.com/org/repo"]]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user