summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2015-10-12 21:35:52 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2015-10-12 22:32:29 +0200
commitdaca1c6511c3a09d5f0c33a8c4d29487e668afc2 (patch)
tree09ed2762efbf1bf1268673d474649442285b91e2
parentc61dc1315077ad4e175a3c76991872c0e7b1d2ab (diff)
downloadgitlab-ce-daca1c6511c3a09d5f0c33a8c4d29487e668afc2.tar.gz
Fix broken tests
-rw-r--r--app/models/ci/commit.rb4
-rw-r--r--lib/api/commit_statuses.rb2
-rw-r--r--spec/models/ci/commit_spec.rb9
3 files changed, 8 insertions, 7 deletions
diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb
index 296890c5e7c..f6fc4645947 100644
--- a/app/models/ci/commit.rb
+++ b/app/models/ci/commit.rb
@@ -82,7 +82,7 @@ module Ci
end
def stage
- running_or_pending = statuses.latest.running_or_pending
+ running_or_pending = statuses.latest.running_or_pending.ordered
running_or_pending.first.try(:stage)
end
@@ -189,7 +189,7 @@ module Ci
end
def matrix_for_ref?(ref)
- latest_builds_for_ref(ref).size > 1
+ builds_without_retry_for_ref(ref).size > 1
end
def config_processor
diff --git a/lib/api/commit_statuses.rb b/lib/api/commit_statuses.rb
index 50ca89079e0..2c0596c9dfb 100644
--- a/lib/api/commit_statuses.rb
+++ b/lib/api/commit_statuses.rb
@@ -43,7 +43,7 @@ module API
# Examples:
# POST /projects/:id/statuses/:sha
post ':id/statuses/:sha' do
- authorize! :create_commit_statuses, user_project
+ authorize! :create_commit_status, user_project
required_attributes! [:state]
attrs = attributes_for_keys [:ref, :target_url, :description, :context, :name]
commit = @project.commit(params[:sha])
diff --git a/spec/models/ci/commit_spec.rb b/spec/models/ci/commit_spec.rb
index 371add4ee59..330971174fb 100644
--- a/spec/models/ci/commit_spec.rb
+++ b/spec/models/ci/commit_spec.rb
@@ -125,7 +125,7 @@ describe Ci::Commit do
end
it 'returns all refs' do
- is_expected.to contain_exactly('master', 'develop')
+ is_expected.to contain_exactly('master', 'develop', nil)
end
end
@@ -225,9 +225,10 @@ describe Ci::Commit do
it 'rebuilds commit' do
expect(commit.status).to eq('skipped')
expect(create_builds(trigger_request)).to be_truthy
- commit.builds.reload
- expect(commit.builds.size).to eq(2)
- expect(commit.status).to eq('pending')
+
+ # since everything in Ci::Commit is cached we need to fetch a new object
+ new_commit = Ci::Commit.find_by_id(commit.id)
+ expect(new_commit.status).to eq('pending')
end
end
end