Commit 388e2a12 authored by Jan Provaznik's avatar Jan Provaznik

Minor review improvements

* renamed scope
* added spec for disabled epics feature
parent a2474646
...@@ -95,7 +95,7 @@ module EE ...@@ -95,7 +95,7 @@ module EE
scope :due_date_inherited, -> { where(due_date_is_fixed: [nil, false]) } scope :due_date_inherited, -> { where(due_date_is_fixed: [nil, false]) }
scope :counts_by_state, -> { group(:state_id).count } scope :counts_by_state, -> { group(:state_id).count }
scope :id_not_in, ->(ids) { where.not(id: ids) } scope :excluding_ids, ->(ids) { where.not(id: ids) }
MAX_HIERARCHY_DEPTH = 5 MAX_HIERARCHY_DEPTH = 5
......
...@@ -31,7 +31,7 @@ module Epics ...@@ -31,7 +31,7 @@ module Epics
def epics_count def epics_count
strong_memoize(:epics_count) do strong_memoize(:epics_count) do
accessible_epics.id_not_in([epic.id]).counts_by_state accessible_epics.excluding_ids([epic.id]).counts_by_state
end end
end end
......
...@@ -117,11 +117,26 @@ describe Epic do ...@@ -117,11 +117,26 @@ describe Epic do
context 'with authorized user' do context 'with authorized user' do
before do before do
private_group.add_developer(user) private_group.add_developer(user)
stub_licensed_features(epics: true)
end end
it 'returns epic groups user can access' do context 'with epics enabled' do
expect(subject).to eq [private_group] before do
stub_licensed_features(epics: true)
end
it 'returns epic groups user can access' do
expect(subject).to eq [private_group]
end
end
context 'with epics are disabled' do
before do
stub_licensed_features(epics: false)
end
it 'returns an empty list' do
expect(subject).to be_empty
end
end end
end end
end 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