Skip to content

Instantly share code, notes, and snippets.

@PrototypeAlex
Created December 19, 2011 21:22
Show Gist options
  • Save PrototypeAlex/1498938 to your computer and use it in GitHub Desktop.
Save PrototypeAlex/1498938 to your computer and use it in GitHub Desktop.
Redirect_to problem
// LockerController
def make_payment
@locker = Locker.find(params[:id])
respond_to do |format|
if !@locker || @locker.user
format.html { redirect_to user_lockers_url, notice: "Opps, something went wrong, please try again" }
else
reply = Nestful.post PXPAYURL, :format => :xml, :body => generate_request_xml(@locker).target!
if reply['valid'].to_i == 1
format.html { redirect_to reply['URI'] }
else
raise reply.inspect
end
end
end
end
// And the integration test
describe 'GET make_payment' do
it 'should be able to redirect to the DPS hosted site' do
locker = Locker.make!
visit user_make_payment_url(locker.id)
page.should have_button('Purchase a New Locker')
end
end
Failure/Error: click_link('YES')
ActionController::RoutingError:
No route matches [GET] "/pxpay/pxpay.aspx"
# (eval):2:in `click_link'
# ./spec/requests/user/user_lockers_spec.rb:89:in `block (3 levels) in <top (required)>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment