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