Commit e53a56ac authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix broken tests

parent 6384c757
......@@ -66,30 +66,6 @@ module Ci
class << self
include Ci::CurrentSettings
def base_build_script
<<-eos
git submodule update --init
ls -la
eos
end
def parse(project)
params = {
gitlab_id: project.id,
default_ref: project.default_branch || 'master',
email_add_pusher: current_application_settings.add_pusher,
email_only_broken_builds: current_application_settings.all_broken_builds,
}
project = Ci::Project.new(params)
project.build_missing_services
project
end
def already_added?(project)
where(gitlab_id: project.id).any?
end
def unassigned(runner)
joins("LEFT JOIN #{Ci::RunnerProject.table_name} ON #{Ci::RunnerProject.table_name}.project_id = #{Ci::Project.table_name}.id " \
"AND #{Ci::RunnerProject.table_name}.runner_id = #{runner.id}").
......
......@@ -28,8 +28,8 @@
require 'spec_helper'
describe Ci::Project do
let(:gl_project) { FactoryGirl.create :empty_project }
let(:project) { FactoryGirl.create :ci_project, gl_project: gl_project }
let(:project) { FactoryGirl.create :ci_project }
let(:gl_project) { project.gl_project }
subject { project }
it { is_expected.to have_many(:runner_projects) }
......@@ -194,18 +194,6 @@ describe Ci::Project do
end
end
describe 'Project.parse' do
let(:project) { FactoryGirl.create :project }
subject { Ci::Project.parse(project) }
it { is_expected.to be_valid }
it { is_expected.to be_kind_of(Ci::Project) }
it { expect(subject.name).to eq(project.name_with_namespace) }
it { expect(subject.gitlab_id).to eq(project.id) }
it { expect(subject.gitlab_url).to eq(project.web_url) }
end
describe :repo_url_with_auth do
let(:project) { FactoryGirl.create :ci_project }
subject { project.repo_url_with_auth }
......
......@@ -5,7 +5,7 @@ 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) }
let(:gl_project) { project.gl_project }
before do
stub_ci_commit_to_return_yaml_file
......@@ -14,7 +14,7 @@ describe Ci::API::API do
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) }
let(:shared_gl_project) { shared_project.gl_project }
before do
FactoryGirl.create :ci_runner_project, project_id: project.id, runner_id: runner.id
......
......@@ -4,7 +4,7 @@ describe Ci::API::API, 'Commits' do
include ApiHelpers
let(:project) { FactoryGirl.create(:ci_project) }
let(:gl_project) { FactoryGirl.create(:empty_project, gitlab_ci_project: project) }
let(:gl_project) { project.gl_project }
let(:commit) { FactoryGirl.create(:ci_commit, gl_project: gl_project) }
let(:options) do
......
......@@ -41,8 +41,8 @@ describe Ci::API::API do
describe "GET /projects/owned" do
let!(:gl_project1) {FactoryGirl.create(:empty_project, namespace: user.namespace)}
let!(:gl_project2) {FactoryGirl.create(:empty_project, namespace: user.namespace)}
let!(:project1) { FactoryGirl.create(:ci_project, gl_project: gl_project1) }
let!(:project2) { FactoryGirl.create(:ci_project, gl_project: gl_project2) }
let!(:project1) { gl_project1.ensure_gitlab_ci_project }
let!(:project2) { gl_project2.ensure_gitlab_ci_project }
before do
project1.gl_project.team << [user, :developer]
......@@ -180,39 +180,6 @@ describe Ci::API::API do
end
end
describe "POST /projects" do
let(:gl_project) { FactoryGirl.create :empty_project }
let(:project_info) do
{
gitlab_id: gl_project.id
}
end
let(:invalid_project_info) { {} }
context "with valid project info" do
before do
options.merge!(project_info)
end
it "should create a project with valid data" do
post ci_api("/projects"), options
expect(response.status).to eq(201)
expect(json_response['name']).to eq(gl_project.name_with_namespace)
end
end
context "with invalid project info" do
before do
options.merge!(invalid_project_info)
end
it "should error with invalid data" do
post ci_api("/projects"), options
expect(response.status).to eq(400)
end
end
describe "POST /projects/:id/runners/:id" do
let(:project) { FactoryGirl.create(:ci_project) }
let(:runner) { FactoryGirl.create(:ci_runner) }
......@@ -262,5 +229,4 @@ describe Ci::API::API do
expect(response.status).to eq(401)
end
end
end
end
......@@ -6,7 +6,7 @@ describe Ci::API::API do
describe 'POST /projects/:project_id/refs/:ref/trigger' do
let!(:trigger_token) { 'secure token' }
let!(:gl_project) { FactoryGirl.create(:project) }
let!(:project) { FactoryGirl.create(:ci_project, gl_project: gl_project) }
let!(:project) { gl_project.ensure_gitlab_ci_project }
let!(:project2) { FactoryGirl.create(:ci_project) }
let!(:trigger) { FactoryGirl.create(:ci_trigger, project: project, token: trigger_token) }
let(:options) do
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe Ci::CreateTriggerRequestService do
let(:service) { Ci::CreateTriggerRequestService.new }
let(:gl_project) { create(:project) }
let(:project) { create(:ci_project, gl_project: gl_project) }
let(:project) { gl_project.ensure_gitlab_ci_project }
let(:trigger) { create(:ci_trigger, project: project) }
before do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment