Read about our upcoming Code of Conduct on this issue

Commit 021d3810 authored by Kamil Trzcinski's avatar Kamil Trzcinski
Browse files

Rename Ci::Commit to Ci::Pipeline and rename some of the ci_commit to pipeline

parent acf653e416fe
......@@ -17,7 +17,7 @@
#
FactoryGirl.define do
factory :ci_empty_commit, class: Ci::Commit do
factory :ci_empty_commit, class: Ci::Pipeline do
sha '97de212e80737a608d939f648d959671fb0a0142'
project factory: :empty_project
......
......@@ -167,7 +167,7 @@
context 'with gitlab-ci.yml' do
before { stub_ci_commit_to_return_yaml_file }
it { expect{ click_on 'Create pipeline' }.to change{ Ci::Commit.count }.by(1) }
it { expect{ click_on 'Create pipeline' }.to change{ Ci::Pipeline.count }.by(1) }
end
context 'without gitlab-ci.yml' do
......
......@@ -3,8 +3,8 @@
describe CiStatusHelper do
include IconsHelper
let(:success_commit) { double("Ci::Commit", status: 'success') }
let(:failed_commit) { double("Ci::Commit", status: 'failed') }
let(:success_commit) { double("Ci::Pipeline", status: 'success') }
let(:failed_commit) { double("Ci::Pipeline", status: 'failed') }
describe 'ci_icon_for_status' do
it { expect(helper.ci_icon_for_status(success_commit.status)).to include('fa-check') }
......
......@@ -5,7 +5,7 @@
let(:project) { create :project }
let(:merge_request) { MergeRequest.new }
let(:ci_service) { CiService.new }
let(:last_commit) { Ci::Commit.new({}) }
let(:last_commit) { Ci::Pipeline.new({}) }
before do
allow(merge_request).to receive(:source_project).and_return(project)
......
require 'spec_helper'
describe Ci::Commit, models: true do
describe Ci::Pipeline, models: true do
let(:project) { FactoryGirl.create :empty_project }
let(:commit) { FactoryGirl.create :ci_commit, project: project }
......
......@@ -402,7 +402,7 @@
with('123abc', 'master').
and_return(ci_commit)
expect(subject.ci_commit).to eq(ci_commit)
expect(subject.pipeline).to eq(ci_commit)
end
end
......@@ -410,7 +410,7 @@
it 'returns nil' do
allow(subject).to receive(:source_project).and_return(nil)
expect(subject.ci_commit).to be_nil
expect(subject.pipeline).to be_nil
end
end
end
......
......@@ -403,7 +403,7 @@
let(:project) { create :project }
let(:commit) { create :ci_commit, project: project, ref: 'master' }
subject { project.ci_commit(commit.sha, 'master') }
subject { project.pipeline(commit.sha, 'master') }
it { is_expected.to eq(commit) }
......
......@@ -16,8 +16,8 @@
let(:get_url) { "/projects/#{project.id}/repository/commits/#{sha}/statuses" }
context 'ci commit exists' do
let!(:master) { project.ci_commits.create(sha: commit.id, ref: 'master') }
let!(:develop) { project.ci_commits.create(sha: commit.id, ref: 'develop') }
let!(:master) { project.pipelines.create(sha: commit.id, ref: 'master') }
let!(:develop) { project.pipelines.create(sha: commit.id, ref: 'develop') }
it_behaves_like 'a paginated resources' do
let(:request) { get api(get_url, reporter) }
......
......@@ -388,7 +388,7 @@
end
describe "PUT /projects/:id/merge_requests/:merge_request_id/merge" do
let(:ci_commit) { create(:ci_commit_without_jobs) }
let(:pipeline) { create(:ci_commit_without_jobs) }
it "should return merge_request in case of success" do
put api("/projects/#{project.id}/merge_requests/#{merge_request.id}/merge", user)
......@@ -429,7 +429,7 @@
end
it "enables merge when build succeeds if the ci is active" do
allow_any_instance_of(MergeRequest).to receive(:ci_commit).and_return(ci_commit)
allow_any_instance_of(MergeRequest).to receive(:pipeline).and_return(pipeline)
allow(ci_commit).to receive(:active?).and_return(true)
put api("/projects/#{project.id}/merge_requests/#{merge_request.id}/merge", user), merge_when_build_succeeds: true
......
......@@ -44,7 +44,7 @@
end
context 'Have a commit' do
let(:commit) { project.ci_commits.last }
let(:commit) { project.pipelines.last }
it 'should create builds' do
post api("/projects/#{project.id}/trigger/builds"), options.merge(ref: 'master')
......
......@@ -36,7 +36,7 @@
end
context 'Have a commit' do
let(:commit) { project.ci_commits.last }
let(:commit) { project.pipelines.last }
it 'should create builds' do
post ci_api("/projects/#{project.ci_id}/refs/master/trigger"), options
......
......@@ -20,10 +20,10 @@
)
end
it { expect(commit).to be_kind_of(Ci::Commit) }
it { expect(commit).to be_kind_of(Ci::Pipeline) }
it { expect(commit).to be_valid }
it { expect(commit).to be_persisted }
it { expect(commit).to eq(project.ci_commits.last) }
it { expect(commit).to eq(project.pipelines.last) }
it { expect(commit.builds.first).to be_kind_of(Ci::Build) }
end
......@@ -61,12 +61,12 @@
commits: [{ message: 'Message' }]
)
expect(result).to be_falsey
expect(Ci::Commit.count).to eq(0)
expect(Ci::Pipeline.count).to eq(0)
end
it 'fails commits if yaml is invalid' do
message = 'message'
allow_any_instance_of(Ci::Commit).to receive(:git_commit_message) { message }
allow_any_instance_of(Ci::Pipeline).to receive(:git_commit_message) { message }
stub_ci_commit_yaml_file('invalid: file: file')
commits = [{ message: message }]
commit = service.execute(project, user,
......@@ -85,7 +85,7 @@
let(:message) { "some message[ci skip]" }
before do
allow_any_instance_of(Ci::Commit).to receive(:git_commit_message) { message }
allow_any_instance_of(Ci::Pipeline).to receive(:git_commit_message) { message }
end
it "skips builds creation if there is [ci skip] tag in commit message" do
......@@ -102,7 +102,7 @@
end
it "does not skips builds creation if there is no [ci skip] tag in commit message" do
allow_any_instance_of(Ci::Commit).to receive(:git_commit_message) { "some message" }
allow_any_instance_of(Ci::Pipeline).to receive(:git_commit_message) { "some message" }
commits = [{ message: "some message" }]
commit = service.execute(project, user,
......@@ -133,7 +133,7 @@
end
it "skips build creation if there are already builds" do
allow_any_instance_of(Ci::Commit).to receive(:ci_yaml_file) { gitlab_ci_yaml }
allow_any_instance_of(Ci::Pipeline).to receive(:ci_yaml_file) { gitlab_ci_yaml }
commits = [{ message: "message" }]
commit = service.execute(project, user,
......
......@@ -116,7 +116,7 @@
before do
# This behavior of MergeRequest: we instantiate a new object
allow_any_instance_of(MergeRequest).to receive(:ci_commit).and_wrap_original do
Ci::Commit.find(ci_commit.id)
Ci::Pipeline.find(ci_commit.id)
end
# We create test after the build
......
......@@ -18,7 +18,7 @@ def stub_ci_commit_to_return_yaml_file
end
def stub_ci_commit_yaml_file(ci_yaml)
allow_any_instance_of(Ci::Commit).to receive(:ci_yaml_file) { ci_yaml }
allow_any_instance_of(Ci::Pipeline).to receive(:ci_yaml_file) { ci_yaml }
end
def stub_ci_builds_disabled
......
......@@ -52,16 +52,16 @@
context "gitlab-ci.yml" do
subject { PostReceive.new.perform(pwd(project), key_id, base64_changes) }
context "creates a Ci::Commit for every change" do
context "creates a Ci::Pipeline for every change" do
before { stub_ci_commit_to_return_yaml_file }
it { expect{ subject }.to change{ Ci::Commit.count }.by(2) }
it { expect{ subject }.to change{ Ci::Pipeline.count }.by(2) }
end
context "does not create a Ci::Commit" do
context "does not create a Ci::Pipeline" do
before { stub_ci_commit_yaml_file(nil) }
it { expect{ subject }.not_to change{ Ci::Commit.count } }
it { expect{ subject }.not_to change{ Ci::Pipeline.count } }
end
end
end
......
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