Commit 598243c0 authored by Kamil Trzcinski's avatar Kamil Trzcinski
Browse files

Fix specs

parent 5fcfcd85
......@@ -15,7 +15,7 @@ describe GitlabCiYamlProcessor do
config_processor.builds_for_stage_and_ref(type, "master").size.should == 1
config_processor.builds_for_stage_and_ref(type, "master").first.should == {
type: "test",
stage: "test",
except: nil,
name: :rspec,
only: nil,
......@@ -113,7 +113,7 @@ describe GitlabCiYamlProcessor do
config_processor.builds_for_stage_and_ref("test", "master").size.should == 1
config_processor.builds_for_stage_and_ref("test", "master").first.should == {
except: nil,
type: "test",
stage: "test",
name: :rspec,
only: nil,
script: "pwd\nrspec",
......@@ -139,7 +139,7 @@ describe GitlabCiYamlProcessor do
config_processor.builds_for_stage_and_ref("test", "master").size.should == 1
config_processor.builds_for_stage_and_ref("test", "master").first.should == {
except: nil,
type: "test",
stage: "test",
name: :rspec,
only: nil,
script: "pwd\nrspec",
......@@ -235,39 +235,39 @@ describe GitlabCiYamlProcessor do
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: allow_failure parameter should be an boolean")
end
it "returns errors if job type is not a string" do
config = YAML.dump({rspec: {script: "test", type: false, allow_failure: "string"}})
it "returns errors if job stage is not a string" do
config = YAML.dump({rspec: {script: "test", type: 1, allow_failure: "string"}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: type should be a string")
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: stage parameter should be build, test, deploy")
end
it "returns errors if job type is not a pre-defined type" do
it "returns errors if job stage is not a pre-defined stage" do
config = YAML.dump({rspec: {script: "test", type: "acceptance", allow_failure: "string"}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: type parameter should be build, test, deploy")
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: stage parameter should be build, test, deploy")
end
it "returns errors if job type is not a defined type" do
it "returns errors if job stage is not a defined stage" do
config = YAML.dump({types: ["build", "test"], rspec: {script: "test", type: "acceptance", allow_failure: "string"}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: type parameter should be build, test")
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: stage parameter should be build, test")
end
it "returns errors if types is not an array" do
it "returns errors if stages is not an array" do
config = YAML.dump({types: "test", rspec: {script: "test"}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "types should be an array of strings")
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "stages should be an array of strings")
end
it "returns errors if types is not an array of strings" do
it "returns errors if stages is not an array of strings" do
config = YAML.dump({types: [true, "test"], rspec: {script: "test"}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "types should be an array of strings")
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "stages should be an array of strings")
end
end
end
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment