Remove format html from quickpay

This commit is contained in:
benji 2015-10-29 11:54:02 +01:00
parent 6248e1211a
commit f109f5eb18
2 changed files with 4 additions and 16 deletions

View file

@ -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

View file

@ -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