Fix tests

This commit is contained in:
Kamil Trzcinski
2015-11-19 12:09:34 +01:00
parent 2b907f61ff
commit 0df7a32ea5
2 changed files with 20 additions and 20 deletions
+1 -1
View File
@@ -196,7 +196,7 @@ module Ci
rescue Psych::SyntaxError => e
save_yaml_error(e.message)
nil
rescue Exception => e
rescue Exception
save_yaml_error("Undefined yaml error")
nil
end
+19 -19
View File
@@ -53,7 +53,7 @@ module Ci
end
end
it 'fails commits without .gitlab-ci.yml' do
it 'skips commits without .gitlab-ci.yml' do
stub_ci_commit_yaml_file(nil)
result = service.execute(project, user,
ref: 'refs/heads/0_1',
@@ -63,7 +63,24 @@ module Ci
)
expect(result).to be_persisted
expect(result.builds.any?).to be_falsey
expect(result.status).to eq('failed')
expect(result.status).to eq('skipped')
expect(commit.yaml_errors).to_not be_nil
end
it 'skips commits if yaml is invalid' do
message = 'message'
allow_any_instance_of(Ci::Commit).to receive(:git_commit_message) { message }
stub_ci_commit_yaml_file('invalid: file: file')
commits = [{ message: message }]
commit = service.execute(project, user,
ref: 'refs/tags/0_1',
before: '00000000',
after: '31das312',
commits: commits
)
expect(commit.builds.any?).to be false
expect(commit.status).to eq('skipped')
expect(commit.yaml_errors).to_not be_nil
end
describe :ci_skip? do
@@ -114,23 +131,6 @@ module Ci
end
end
describe :config_processor do
it "skips builds creation if yaml is invalid" do
allow_any_instance_of(Ci::Commit).to receive(:git_commit_message) { "message" }
stub_ci_commit_yaml_file('invalid: file: file')
commits = [{ message: message }]
commit = service.execute(project, user,
ref: 'refs/tags/0_1',
before: '00000000',
after: '31das312',
commits: commits
)
expect(commit.builds.any?).to be false
expect(commit.status).to eq("skipped")
expect(commit.yaml_errors).to_not be_nil
end
end
it "skips build creation if there are already builds" do
allow_any_instance_of(Ci::Commit).to receive(:ci_yaml_file) { gitlab_ci_yaml }