mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-20 10:06:04 +10:00
Rename CiStatus to Statusable
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
module Ci
|
||||
class Commit < ActiveRecord::Base
|
||||
extend Ci::Model
|
||||
include CiStatus
|
||||
include Statuseable
|
||||
|
||||
belongs_to :project, class_name: '::Project', foreign_key: :gl_project_id
|
||||
has_many :statuses, class_name: 'CommitStatus'
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#
|
||||
|
||||
class CommitStatus < ActiveRecord::Base
|
||||
include CiStatus
|
||||
include Statuseable
|
||||
|
||||
self.table_name = 'ci_builds'
|
||||
|
||||
@@ -81,7 +81,11 @@ class CommitStatus < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
delegate :before_sha, :sha, :short_sha, to: :commit, prefix: false
|
||||
delegate :sha, :short_sha, to: :commit
|
||||
|
||||
def before_sha
|
||||
commit.before_sha || Gitlab::Git::BLANK_SHA
|
||||
end
|
||||
|
||||
def self.stages
|
||||
order_by = 'max(stage_idx)'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module CiStatus
|
||||
module Statuseable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
AVAILABLE_STATUSES = %w(pending running success failed canceled skipped)
|
||||
@@ -41,7 +41,7 @@ module CiStatus
|
||||
end
|
||||
|
||||
def finished_at
|
||||
all.minimum(:finished_at)
|
||||
all.maximum(:finished_at)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -958,7 +958,7 @@ class Project < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def ci_commit(sha, ref)
|
||||
ci_commits.find_by(sha: sha, ref: ref)
|
||||
ci_commits.order(id: :desc).find_by(sha: sha, ref: ref)
|
||||
end
|
||||
|
||||
def ensure_ci_commit(sha, ref)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.gray-content-block.middle-block
|
||||
.pull-right
|
||||
- if can?(current_user, :update_build, @project)
|
||||
- if can?(current_user, :update_build, @ci_commit.project)
|
||||
- if ci_commit.builds.latest.failed.any?(&:retryable?)
|
||||
= link_to "Retry failed", retry_builds_namespace_project_commit_path(@project.namespace, @project, ci_commit.sha), class: 'btn btn-grouped btn-primary', method: :post
|
||||
|
||||
|
||||
@@ -163,4 +163,12 @@ eos
|
||||
it { expect(commit.reverts_commit?(another_commit)).to be_truthy }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#ci_commits' do
|
||||
# TODO: kamil
|
||||
end
|
||||
|
||||
describe '#status' do
|
||||
# TODO: kamil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe CiStatus do
|
||||
describe Statuseable do
|
||||
before do
|
||||
@object = Object.new
|
||||
@object.extend(CiStatus::ClassMethods)
|
||||
@object.extend(Statuseable::ClassMethods)
|
||||
end
|
||||
|
||||
describe '.status' do
|
||||
Reference in New Issue
Block a user