Skip to content

Commit

Permalink
move module to concerns; use inject instead of reduce
Browse files Browse the repository at this point in the history
  • Loading branch information
weedySeaDragon committed Dec 27, 2019
1 parent 0e46080 commit 9729409
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#--------------------------
#
# @module OrderedNestedListEntry
# @module OrderedAncestryEntry
#
# @desc Responsibility: Abstract class for objects with _ordered_ nested
# descendents using the ancestry gem.``
Expand Down
2 changes: 1 addition & 1 deletion app/models/user_checklist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def self.not_completed_by_user(user)
# --------------------------------------------------------------------------

def completed?
!date_completed.blank? && descendants.reduce(:true) { |is_completed, descendant| descendant.completed? && is_completed }
!date_completed.blank? && descendants.inject(:true) { |is_completed, descendant| descendant.completed? && is_completed }
end


Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion spec/models/user_checklist_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
user_1 = checklist_1.user
2.times { create(:user_checklist, :completed, user: user_1) }

checklist_last = create(:user_checklist, :completed)
create(:user_checklist, :completed)

expect(described_class.completed_by_user(user_1).count).to eq 3
end
Expand Down

0 comments on commit 9729409

Please sign in to comment.