Remove format html from quickpay
This commit is contained in:
parent
6248e1211a
commit
f109f5eb18
2 changed files with 4 additions and 16 deletions
|
@ -29,21 +29,9 @@ class UsersController < ApplicationController
|
|||
order = @user.orders.build
|
||||
order.order_items.build(count: 1, product: @user.dagschotel)
|
||||
if order.save
|
||||
respond_to do |format|
|
||||
format.js { render json: { message: "Quick pay succeeded for #{@user.name}." }, status: :ok }
|
||||
format.html {
|
||||
flash[:success] = "Quick pay succeeded."
|
||||
redirect_to root_path
|
||||
}
|
||||
end
|
||||
render json: { message: "Quick pay succeeded for #{@user.name}." }, status: :ok
|
||||
else
|
||||
respond_to do |format|
|
||||
format.js { head :unprocessable_entity }
|
||||
format.html {
|
||||
flash[:error] = order.errors.full_messages.first
|
||||
redirect_to root_path
|
||||
}
|
||||
end
|
||||
head :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -144,8 +144,8 @@ describe UsersController, type: :controller do
|
|||
end
|
||||
|
||||
it 'should fail' do
|
||||
get :quickpay, id: @user
|
||||
expect(response).to have_http_status(302)
|
||||
xhr :get, :quickpay, id: @user
|
||||
expect(response).to have_http_status(422)
|
||||
end
|
||||
|
||||
it 'should not make an order' do
|
||||
|
|
Loading…
Reference in a new issue