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

Comments are now closed.

%d bloggers like this: