From 30c78e70cba395c1336611c58891a75473f8a037 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Mon, 28 Sep 2015 13:14:34 +0200 Subject: WIP --- spec/requests/ci/api/builds_spec.rb | 16 +++++++++------- spec/requests/ci/api/commits_spec.rb | 3 ++- spec/requests/ci/api/triggers_spec.rb | 3 ++- spec/requests/ci/builds_spec.rb | 3 +-- spec/requests/ci/commits_spec.rb | 3 +-- 5 files changed, 15 insertions(+), 13 deletions(-) (limited to 'spec/requests') diff --git a/spec/requests/ci/api/builds_spec.rb b/spec/requests/ci/api/builds_spec.rb index c25d1823306..bad250fbf48 100644 --- a/spec/requests/ci/api/builds_spec.rb +++ b/spec/requests/ci/api/builds_spec.rb @@ -5,10 +5,12 @@ describe Ci::API::API do let(:runner) { FactoryGirl.create(:ci_runner, tag_list: ["mysql", "ruby"]) } let(:project) { FactoryGirl.create(:ci_project) } + let(:gl_project) { FactoryGirl.create(:empty_project, gitlab_ci_project: project) } describe "Builds API for runners" do let(:shared_runner) { FactoryGirl.create(:ci_runner, token: "SharedRunner") } let(:shared_project) { FactoryGirl.create(:ci_project, name: "SharedProject") } + let(:shared_gl_project) { FactoryGirl.create(:empty_project, gitlab_ci_project: shared_project) } before do FactoryGirl.create :ci_runner_project, project_id: project.id, runner_id: runner.id @@ -16,7 +18,7 @@ describe Ci::API::API do describe "POST /builds/register" do it "should start a build" do - commit = FactoryGirl.create(:ci_commit, project: project) + commit = FactoryGirl.create(:ci_commit, gl_project: gl_project) commit.create_builds build = commit.builds.first @@ -34,7 +36,7 @@ describe Ci::API::API do end it "should return 404 error if no builds for specific runner" do - commit = FactoryGirl.create(:ci_commit, project: shared_project) + commit = FactoryGirl.create(:ci_commit, gl_project: shared_gl_project) FactoryGirl.create(:ci_build, commit: commit, status: 'pending' ) post ci_api("/builds/register"), token: runner.token @@ -43,7 +45,7 @@ describe Ci::API::API do end it "should return 404 error if no builds for shared runner" do - commit = FactoryGirl.create(:ci_commit, project: project) + commit = FactoryGirl.create(:ci_commit, gl_project: gl_project) FactoryGirl.create(:ci_build, commit: commit, status: 'pending' ) post ci_api("/builds/register"), token: shared_runner.token @@ -52,7 +54,7 @@ describe Ci::API::API do end it "returns options" do - commit = FactoryGirl.create(:ci_commit, project: project) + commit = FactoryGirl.create(:ci_commit, gl_project: gl_project) commit.create_builds post ci_api("/builds/register"), token: runner.token, info: { platform: :darwin } @@ -62,7 +64,7 @@ describe Ci::API::API do end it "returns variables" do - commit = FactoryGirl.create(:ci_commit, project: project) + commit = FactoryGirl.create(:ci_commit, gl_project: gl_project) commit.create_builds project.variables << Ci::Variable.new(key: "SECRET_KEY", value: "secret_value") @@ -77,7 +79,7 @@ describe Ci::API::API do it "returns variables for triggers" do trigger = FactoryGirl.create(:ci_trigger, project: project) - commit = FactoryGirl.create(:ci_commit, project: project) + commit = FactoryGirl.create(:ci_commit, gl_project: gl_project) trigger_request = FactoryGirl.create(:ci_trigger_request_with_variables, commit: commit, trigger: trigger) commit.create_builds(trigger_request) @@ -95,7 +97,7 @@ describe Ci::API::API do end describe "PUT /builds/:id" do - let(:commit) { FactoryGirl.create(:ci_commit, project: project)} + let(:commit) { FactoryGirl.create(:ci_commit, gl_project: gl_project)} let(:build) { FactoryGirl.create(:ci_build, commit: commit, runner_id: runner.id) } it "should update a running build" do diff --git a/spec/requests/ci/api/commits_spec.rb b/spec/requests/ci/api/commits_spec.rb index e89b6651499..a41c321a300 100644 --- a/spec/requests/ci/api/commits_spec.rb +++ b/spec/requests/ci/api/commits_spec.rb @@ -4,7 +4,8 @@ describe Ci::API::API, 'Commits' do include ApiHelpers let(:project) { FactoryGirl.create(:ci_project) } - 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) } let(:options) do { diff --git a/spec/requests/ci/api/triggers_spec.rb b/spec/requests/ci/api/triggers_spec.rb index ff6fdbdd6f1..bbe98e7dacd 100644 --- a/spec/requests/ci/api/triggers_spec.rb +++ b/spec/requests/ci/api/triggers_spec.rb @@ -6,6 +6,7 @@ describe Ci::API::API do describe 'POST /projects/:project_id/refs/:ref/trigger' do let!(:trigger_token) { 'secure token' } let!(:project) { FactoryGirl.create(:ci_project) } + let!(:gl_project) { FactoryGirl.create(:empty_project, gitlab_ci_project: project) } let!(:project2) { FactoryGirl.create(:ci_project) } let!(:trigger) { FactoryGirl.create(:ci_trigger, project: project, token: trigger_token) } let(:options) do @@ -33,7 +34,7 @@ describe Ci::API::API do context 'Have a commit' do before do - @commit = FactoryGirl.create(:ci_commit, project: project) + @commit = FactoryGirl.create(:ci_commit, gl_project: gl_project) end it 'should create builds' do diff --git a/spec/requests/ci/builds_spec.rb b/spec/requests/ci/builds_spec.rb index 998c386ead4..32ca52686a9 100644 --- a/spec/requests/ci/builds_spec.rb +++ b/spec/requests/ci/builds_spec.rb @@ -2,8 +2,7 @@ require 'spec_helper' describe "Builds" do before do - @project = FactoryGirl.create :ci_project - @commit = FactoryGirl.create :ci_commit, project: @project + @commit = FactoryGirl.create :ci_commit @build = FactoryGirl.create :ci_build, commit: @commit end diff --git a/spec/requests/ci/commits_spec.rb b/spec/requests/ci/commits_spec.rb index fb317670339..4d7f132023b 100644 --- a/spec/requests/ci/commits_spec.rb +++ b/spec/requests/ci/commits_spec.rb @@ -2,8 +2,7 @@ require 'spec_helper' describe "Commits" do before do - @project = FactoryGirl.create :ci_project - @commit = FactoryGirl.create :ci_commit, project: @project + @commit = FactoryGirl.create :ci_commit end describe "GET /:project/refs/:ref_name/commits/:id/status.json" do -- cgit v1.2.1