Cucumber visiting pages using different formats

Ever wonder how you can write a cucumber test that would test how your web app responds to a different format, something like JSON or XML?
I was trying to do the following:

Running this code I would get a “Can’t find mapping from “the feeds page using json” to a path.

Trying to figure out how I can do this, I tried to write a new step, like this:

but this resulted in: Ambiguous match of “I go to the feeds page using json”

So, I posted the question on StackOverFlow and it seems everyone was thinking the same way I was.

I continued playing  with this idea and here is how I solved the problem:

Modifying the paths.rb file, I changed (Changes are in bold)

This way I don’t have to modify anything else in my features and everything just works.

1 Comment

  1. Vladimir Zhukov

    Thanks, Andrew!
    That is what I needed!

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">