From 0f3deac362cf2800ceaf17f4cded765f6c9d577c Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski <ayufan@ayufan.eu> Date: Mon, 28 Sep 2015 16:49:31 +0200 Subject: [PATCH] Fix tests --- features/steps/project/commits/commits.rb | 2 +- features/steps/shared/project.rb | 2 +- spec/lib/ci/charts_spec.rb | 5 ++--- spec/models/project_spec.rb | 8 +++++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/features/steps/project/commits/commits.rb b/features/steps/project/commits/commits.rb index 56f1f06fb0686..47f58091b93b0 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 fa841f67510a6..fc51cec150e7e 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 24894e8198380..83e2ad220b832 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 9e7b6f5cb30ee..cbb49044cd1ba 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 -- GitLab