Module: CartsHelper

Defined in:
app/helpers/carts_helper.rb

Instance Method Summary collapse

Instance Method Details

#display_status(cart, user) ⇒ Object

need to pass in the user because the current_user controller helper can't be stubbed github.com/rspec/rspec-rails/issues/1076


4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/helpers/carts_helper.rb', line 4

def display_status(cart, user)
  if cart.pending?
    approvers = cart.currently_awaiting_approvers
    if approvers.include?(user)
      ('strong', "Please review")
    else
      names = approvers.map{|approver| approver.full_name }
      ('em', "Waiting for review from:") + ' ' + names.join(', ')
    end
  else
    cart.status.titlecase
  end
end