diff --git a/features/steps/project/commits/commits.rb b/features/steps/project/commits/commits.rb
index 56f1f06fb06867c3e3295d75c14cbc303aecd869..47f58091b93b0c9790d492a9defbac8d55ee8968 100644
--- a/features/steps/project/commits/commits.rb
+++ b/features/steps/project/commits/commits.rb
@@ -104,7 +104,7 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
 
   step 'commit has ci status' do
     @project.enable_ci(@user)
-    create :ci_commit, project: @project.gitlab_ci_project, sha: sample_commit.id
+    create :ci_commit, gl_project: @project, sha: sample_commit.id
   end
 
   step 'I see commit ci info' do
diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb
index fa841f67510a68550d7f77b2afe87f50096cc576..fc51cec150e7ed99a356f1a8d6ae82794a6cc7cd 100644
--- a/features/steps/shared/project.rb
+++ b/features/steps/shared/project.rb
@@ -204,6 +204,6 @@ def current_project
 
   step 'project "Shop" has CI build' do
     project = Project.find_by(name: "Shop")
-    create :ci_commit, project: project.gitlab_ci_project, sha: project.commit.sha
+    create :ci_commit, gl_project: project, sha: project.commit.sha
   end
 end
diff --git a/spec/lib/ci/charts_spec.rb b/spec/lib/ci/charts_spec.rb
index 24894e8198380661b25750032988acb1efa2015d..83e2ad220b832995607ea94d86ee3a023704d386 100644
--- a/spec/lib/ci/charts_spec.rb
+++ b/spec/lib/ci/charts_spec.rb
@@ -4,13 +4,12 @@
 
   context "build_times" do
     before do
-      @project = FactoryGirl.create(:ci_project)
-      @commit = FactoryGirl.create(:ci_commit, project: @project)
+      @commit = FactoryGirl.create(:ci_commit)
       FactoryGirl.create(:ci_build, commit: @commit)
     end
 
     it 'should return build times in minutes' do
-      chart = Ci::Charts::BuildTime.new(@project)
+      chart = Ci::Charts::BuildTime.new(@commit.project)
       expect(chart.build_times).to eq([2])
     end
   end
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 9e7b6f5cb30ee5ffce3f16b76757437f16588692..cbb49044cd1bad1ce1deac998e79c579a9450960 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -404,10 +404,12 @@
 
   describe :ci_commit do
     let(:project) { create :project }
-    let(:ci_project) { create :ci_project, gl_project: project }
-    let(:commit) { create :ci_commit, project: ci_project }
+    let(:commit) { create :ci_commit, gl_project: project }
 
-    before { project.create_gitlab_ci_service(active: true) }
+    before do
+      project.ensure_ci_project
+      project.create_gitlab_ci_service(active: true)
+    end
 
     it { expect(project.ci_commit(commit.sha)).to eq(commit) }
   end