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

  • Home
  • SEARCH
  • 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 3976792
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:50:49+00:00 2026-05-20T04:50:49+00:00

Chargify has this Cucumber scenario in their docs . Scenario: Retrieve a customer via

  • 0

Chargify has this Cucumber scenario in their docs.

Scenario: Retrieve a customer via my reference id (as an integer or simple string)
Given I have a customer with these attributes
  | reference | first_name | last_name | email           |
  | 7890      | Joe        | Blow      | joe@example.com |
When I send a GET request to https://[@subdomain].chargify.com/customers/lookup.xml?reference=7890
Then the response status should be "200 OK"
And the response should be the xml:
  """
  <?xml version="1.0" encoding="UTF-8"?>
  <customer>
    <id type="integer">`auto generated`</id>
    <first_name>Joe</first_name>
    <last_name>Blow</last_name>
    <email>joe@example.com</email>
    <organization>`your value`</organization>
    <reference>7890</reference>
    <created_at type="datetime">`auto generated`</created_at>
    <updated_at type="datetime">`auto generated`</updated_at>
  </customer>
  """

I’m trying to follow their approach in testing an API we’re developing here, instead of checking for the tags one by one, like I we were doing before coming across this example.

So far no luck matching the response’s output with the step’s multiline string, due to formatting issues. Haven’t found a way with Nokogiri nor with simple stripped string comparison.

Is there an elegant (and efficient) way to do this?

Update

Here’s the cucumber step using Mark’s solution:

Then /^I should see the following output$/ do |xml_output|
  response = Hash.from_xml(page.body)
  expected = Hash.from_xml(xml_output)  
  expected.diff(response).should == {}
end
  • 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-20T04:50:49+00:00Added an answer on May 20, 2026 at 4:50 am

    You can use Hash.from_xml and then compare with Hash.diff. Comparing as hashes eliminates insignificant whitespace from messing up comparisons.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a web application to integrate with Chargify . I want to
I created an API wrapper called Chargify.NET and I'm starting to see a pattern
This might be a subjective question, but I'll give it a go. There are
I'm looking for alternatives to Chargify for a billing system that can be integrated
I'm trying to call RoleEnvironment.GetConfigurationSetting(SOMEKEY) like so: public partial class AzureBasePage : System.Web.UI.Page {
Currently I am working on an application which depends on a lot of external
I've been researching eCommerce payment gateways and service offerings, but I'm an eCommerce novice,
I've seen a few questions related to API specifics and paypal. Generally speaking if

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.