mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-19 09:36:47 +10:00
Fix CI tests
This commit is contained in:
@@ -33,7 +33,7 @@ module Ci
|
||||
|
||||
belongs_to :gl_project, class_name: '::Project', foreign_key: :gitlab_id
|
||||
|
||||
has_many :commits, ->() { order('CASE WHEN commits.committed_at IS NULL THEN 0 ELSE 1 END', :committed_at, :id) }, dependent: :destroy, class_name: 'Ci::Commit'
|
||||
has_many :commits, ->() { order('CASE WHEN ci_commits.committed_at IS NULL THEN 0 ELSE 1 END', :committed_at, :id) }, dependent: :destroy, class_name: 'Ci::Commit'
|
||||
has_many :builds, through: :commits, dependent: :destroy, class_name: 'Ci::Build'
|
||||
has_many :runner_projects, dependent: :destroy, class_name: 'Ci::RunnerProject'
|
||||
has_many :runners, through: :runner_projects, class_name: 'Ci::Runner'
|
||||
|
||||
@@ -67,7 +67,7 @@ describe Ci::Project do
|
||||
it 'returns ordered list of commits' do
|
||||
commit1 = FactoryGirl.create :ci_commit, committed_at: 1.hour.ago, project: project
|
||||
commit2 = FactoryGirl.create :ci_commit, committed_at: 2.hour.ago, project: project
|
||||
project.commits.should == [commit2, commit1]
|
||||
expect(project.commits).to eq([commit2, commit1])
|
||||
end
|
||||
|
||||
it 'returns commits ordered by committed_at and id, with nulls last' do
|
||||
@@ -75,7 +75,7 @@ describe Ci::Project do
|
||||
commit2 = FactoryGirl.create :ci_commit, committed_at: nil, project: project
|
||||
commit3 = FactoryGirl.create :ci_commit, committed_at: 2.hour.ago, project: project
|
||||
commit4 = FactoryGirl.create :ci_commit, committed_at: nil, project: project
|
||||
project.commits.should == [commit2, commit4, commit3, commit1]
|
||||
expect(project.commits).to eq([commit2, commit4, commit3, commit1])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user