【发布时间】:2016-04-26 18:02:20
【问题描述】:
我有checkouts_controller.rb 行动:
def create
if create_customer(params[:stripeToken], @plan.my_plan_id, params[:code], params[:new_price])
redirect_to user_path(id: current_user.to_param, customer_share: true)
else
redirect_to new_checkout_path(plan_id: @plan)
end
end
在users_helper.rb:
def create_customer
if customer != nil
...
else
flash[:error] = 'Something went wrong, please try again.'
end
所以我需要检查 else 并在 rspec 中测试 flash[:error]。
【问题讨论】:
标签: ruby-on-rails ruby rspec