class CouponDecorator < ApplicationDecorator
  decorates :coupon

  def percent_off
    "#{coupon.percent_off}% Off"
  end

  def expiration
    coupon.redeem_by.strftime("%Y-%m-%d")
  end

  def applicable_plans
    coupon.subscription_plans.map {|p| p.name}.join(',')
  end
end
class CouponDecorator < ApplicationDecorator
  decorates :coupon

  def percent_off
    "#{coupon.percent_off}% Off"
  end

  def expiration
    if coupon.redeem_by?
      coupon.redeem_by.strftime("%Y-%m-%d")
    else
      'No expiration'
    end
  end

  def applicable_plans
    coupon.subscription_plans.map {|p| p.name}.join(',')
  end
end
Fix to coupon decorator. Don't assume we have an expiration. Need test coverage on coupon decorator.
Fix to coupon decorator. Don't assume we have an expiration. Need test coverage on coupon decorator.
