Commit 5cfe33c0 authored by Mark Chao's avatar Mark Chao

Allow anyone to approve if no rule exists

Update spec
parent a162503e
......@@ -65,7 +65,7 @@ class ApprovalState
end
def any_approver_allowed?
approved?
regular_rules.empty? || approved?
end
def approvals_required
......
......@@ -189,6 +189,17 @@ describe ApprovalState do
end
describe '#any_approver_allowed?' do
context 'when no rules' do
it 'returns true' do
expect(subject.any_approver_allowed?).to eq(true)
end
end
context 'when with rules' do
before do
create_rule(approvals_required: 1, users: [approver1])
end
context 'when approved' do
before do
allow(subject).to receive(:approved?).and_return(true)
......@@ -209,6 +220,7 @@ describe ApprovalState do
end
end
end
end
describe '#approvals_left' do
before do
......
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