Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6211755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:23:36+00:00 2026-05-24T06:23:36+00:00

I was following this code for cucumber testing with activemerchant and authorize.net(I know it’s

  • 0

I was following this code for cucumber testing with activemerchant and authorize.net(I know it’s old but it’s the one that worked for me)

http://www.misuse.org/science/2007/12/13/using-activemerchant-to-process-credit-cards-in-rubyrails/

Anyway, his fix for the duplicate transaction problem(when going through a lot of cucumber scenarios fast) was to assign a random price to the object so that it will be different every time.

The problem with this is that it effectively makes testing for the correct price almost impossible. How should I rewrite my tests or setup Authorize or Activemerchant to bypass this problem? I am trying to write a test that will check if my cart’s total price if I change some items and this won’t be possible with prices being random.

My only current check for pricing right now(which works) is that I look at the ui and check the price in the div .total-price and check that if it’s equal to the price of all the items added together. It does pass, but what if I changed the price? I surely don’t know how much the total price is(since they’re all random) and I won’t be able to check the new price(since it’s still random)

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:23:37+00:00Added an answer on May 24, 2026 at 6:23 am

    Use webmock or similar library to stub authorize.net.

    Here is example:

     Given /^authorize\.net will authorize payment$/ do
       stub_request(:post, "https://apitest.authorize.net/xml/v1/request.api").
       with(:body => /.*createCustomerProfileRequest.*/).
       to_return(:body => fixturefile("authorize_net_create_profile_ok_response.xml"))
    
       stub_request(:post, "https://apitest.authorize.net/xml/v1/request.api").
       with(:body => /.*createCustomerProfileTransactionRequest.*/).
       to_return(:body => fixturefile("authorize_net_authorize_ok_response.xml"))
     end
    
    • Free Bonus – your tests will work faster and will not depend on authorize.net sandbox uptime
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: Bear in mind that while this code works on
I have ASP.Net code similar to the following (this is inside a FIELDSET): <ol>
I was following this tutorial of Sencha Touch: http://www.vimeo.com/15672696 Perfect tutorial, worked flawless. But
This should be an easy one to track down...but it isn't proving that way
This following code gets this compile error: " invalid types 'int[int]' for array subscript
I am using 'git' to checkout chromium code by following this document: http://code.google.com/p/chromium/wiki/UsingGit And
Did I not get enough sleep or what? This following code var frame=document.getElementById(viewer); frame.width=100;
I need help on this following aspx code aspx Code: <asp:Label ID =lblName runat
I'm wondering why this code section prints out the following: print request.user.has_perm('bug_tracking.is_developer'): + str(request.user.has_perm('bug_tracking.is_developer'))
I have the following code in Ruby. I want to convert this code into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.