Commit c3047547 authored by Igor Drozdov's avatar Igor Drozdov

Merge branch 'fix-approvals-given-count' into 'master'

Fix calculation of given approvals

See merge request gitlab-org/gitlab!28293
parents 982c484c 7af730a0
---
title: Fix number of approvals given calculation
merge_request: 28293
author: Steffen Köhler
type: fixed
......@@ -42,7 +42,7 @@ module Approvable
end
def approvals_given
approvals.size
approvals_required - approvals_left
end
def approvals_before_merge
......
......@@ -27,6 +27,17 @@ describe Approvable do
end
end
describe "#approvals_given" do
subject { merge_request.approvals_given }
it "returns the correct number of approvals given" do
approval_state = double("approval_state", approvals_required: 5, approvals_left: 3)
allow(merge_request).to receive(:approval_state).and_return(approval_state)
expect(subject).to eq(approval_state.approvals_required - approval_state.approvals_left)
end
end
described_class::FORWARDABLE_METHODS.each do |method|
it { is_expected.to delegate_method(method).to(:approval_state) }
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