summaryrefslogtreecommitdiff
path: root/spec/models/ci/commit_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/ci/commit_spec.rb')
-rw-r--r--spec/models/ci/commit_spec.rb23
1 files changed, 13 insertions, 10 deletions
diff --git a/spec/models/ci/commit_spec.rb b/spec/models/ci/commit_spec.rb
index 586c9dc23a7..c277cbd8bc0 100644
--- a/spec/models/ci/commit_spec.rb
+++ b/spec/models/ci/commit_spec.rb
@@ -18,9 +18,8 @@
require 'spec_helper'
describe Ci::Commit do
- let(:project) { FactoryGirl.create :ci_project }
- let(:commit) { FactoryGirl.create :ci_commit, project: project }
- let(:commit_with_project) { FactoryGirl.create :ci_commit, project: project }
+ let(:commit) { FactoryGirl.create :ci_commit }
+ let(:commit_with_project) { FactoryGirl.create :ci_commit }
let(:config_processor) { Ci::GitlabCiYamlProcessor.new(gitlab_ci_yaml) }
it { is_expected.to belong_to(:project) }
@@ -65,7 +64,8 @@ describe Ci::Commit do
project = FactoryGirl.create :ci_project,
email_add_pusher: true,
email_recipients: ''
- commit = FactoryGirl.create :ci_commit, project: project
+ gl_project = FactoryGirl.create :empty_project, gitlab_ci_project: project
+ commit = FactoryGirl.create :ci_commit, gl_project: gl_project
expected = 'commit_pusher_email'
allow(commit).to receive(:push_data) { { user_email: expected } }
expect(commit.project_recipients).to eq([expected])
@@ -75,7 +75,8 @@ describe Ci::Commit do
project = FactoryGirl.create :ci_project,
email_add_pusher: true,
email_recipients: 'rec1 rec2'
- commit = FactoryGirl.create :ci_commit, project: project
+ gl_project = FactoryGirl.create :empty_project, gitlab_ci_project: project
+ commit = FactoryGirl.create :ci_commit, gl_project: gl_project
expected = 'commit_pusher_email'
allow(commit).to receive(:push_data) { { user_email: expected } }
expect(commit.project_recipients).to eq(['rec1', 'rec2', expected])
@@ -85,7 +86,8 @@ describe Ci::Commit do
project = FactoryGirl.create :ci_project,
email_add_pusher: false,
email_recipients: 'rec1 rec2'
- commit = FactoryGirl.create :ci_commit, project: project
+ gl_project = FactoryGirl.create :empty_project, gitlab_ci_project: project
+ commit = FactoryGirl.create :ci_commit, project: gl_project
expect(commit.project_recipients).to eq(['rec1', 'rec2'])
end
@@ -93,7 +95,8 @@ describe Ci::Commit do
project = FactoryGirl.create :ci_project,
email_add_pusher: true,
email_recipients: 'rec1 rec1 rec2'
- commit = FactoryGirl.create :ci_commit, project: project
+ gl_project = FactoryGirl.create :empty_project, gitlab_ci_project: project
+ commit = FactoryGirl.create :ci_commit, project: gl_project
expected = 'rec2'
allow(commit).to receive(:push_data) { { user_email: expected } }
expect(commit.project_recipients).to eq(['rec1', 'rec2'])
@@ -219,8 +222,7 @@ describe Ci::Commit do
end
describe "#finished_at" do
- let(:project) { FactoryGirl.create :ci_project }
- let(:commit) { FactoryGirl.create :ci_commit, project: project }
+ let(:commit) { FactoryGirl.create :ci_commit }
it "returns finished_at of latest build" do
build = FactoryGirl.create :ci_build, commit: commit, finished_at: Time.now - 60
@@ -238,7 +240,8 @@ describe Ci::Commit do
describe "coverage" do
let(:project) { FactoryGirl.create :ci_project, coverage_regex: "/.*/" }
- let(:commit) { FactoryGirl.create :ci_commit, project: project }
+ let(:gl_project) { FactoryGirl.create :empty_project, gitlab_ci_project: project }
+ let(:commit) { FactoryGirl.create :ci_commit, gl_project: gl_project }
it "calculates average when there are two builds with coverage" do
FactoryGirl.create :ci_build, name: "rspec", coverage: 30, commit: commit