Mike Doel
2009-09-30 20:12:42 UTC
If this is better asked on a Fakeweb or Webrat board, redirect me
there...
In our app, we're trying to mock out interaction with a third-party
payment processing service (Braintree in our case). The way
Braintree's transparent redirect model works is that the user form
posts credit card and other billing data to Braintree which redirects
the user back to our app to display the result.
We want our Feature/Scenarios to run without requiring a network
connection, so we have:
FakeWeb.allow_net_connect=false
set. I've tried to write a scenario like this...
Scenario: Submit valid payment data using default address
Given FakeWeb will mimic a braintree success
And I am ready to transact
When I select "VISA" from "Card Type"
And I fill in "Card Number" with "4111111111111111"
And I press "Continue"
Then I should see "Woo - Billing!"
with a step like:
Given /^FakeWeb will mimic a braintree success$/ do
FakeWeb.register_uri :post,'https://
secure.braintreepaymentgateway.com/api/transact.php',
:status => ["301", "Moved Permanently"],
:location => transaction_success_url
(Transaction.last)
end
The URL in the above step of course matches the first parameter to the
form_tag in the view. However, when I try executing this, I get the
error:
No route matches "/api/transact.php" with {:method=>:post}
(ActionController::RoutingError)
(eval):2:in `click_button'
Can anyone suggest what the right way to mock out the network would be
for a case like this? I had thought the above FakeWeb call would
result in the "I press 'Continue'" step getting redirected as
mentioned above, but the error looks like it never even gets to FakeWeb.
Any help/suggestions would be appreciated.
Mike
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/***@public.gmane.org
To unsubscribe from this group, send email to cukes+unsubscribe-/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/cukes?hl=en
-~----------~----~----~----~------~----~------~--~---
there...
In our app, we're trying to mock out interaction with a third-party
payment processing service (Braintree in our case). The way
Braintree's transparent redirect model works is that the user form
posts credit card and other billing data to Braintree which redirects
the user back to our app to display the result.
We want our Feature/Scenarios to run without requiring a network
connection, so we have:
FakeWeb.allow_net_connect=false
set. I've tried to write a scenario like this...
Scenario: Submit valid payment data using default address
Given FakeWeb will mimic a braintree success
And I am ready to transact
When I select "VISA" from "Card Type"
And I fill in "Card Number" with "4111111111111111"
And I press "Continue"
Then I should see "Woo - Billing!"
with a step like:
Given /^FakeWeb will mimic a braintree success$/ do
FakeWeb.register_uri :post,'https://
secure.braintreepaymentgateway.com/api/transact.php',
:status => ["301", "Moved Permanently"],
:location => transaction_success_url
(Transaction.last)
end
The URL in the above step of course matches the first parameter to the
form_tag in the view. However, when I try executing this, I get the
error:
No route matches "/api/transact.php" with {:method=>:post}
(ActionController::RoutingError)
(eval):2:in `click_button'
Can anyone suggest what the right way to mock out the network would be
for a case like this? I had thought the above FakeWeb call would
result in the "I press 'Continue'" step getting redirected as
mentioned above, but the error looks like it never even gets to FakeWeb.
Any help/suggestions would be appreciated.
Mike
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/***@public.gmane.org
To unsubscribe from this group, send email to cukes+unsubscribe-/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/cukes?hl=en
-~----------~----~----~----~------~----~------~--~---