views:

260

answers:

1

Hi,

I'm using Cucumber to test a PHP application, and while most everything works without issue, I haven't yet figured out how to retrieve a response object for a request -- I'm looking to test whether a response is successful (code 200) and also to perform some Hpricot parsings of the response body.

Right now my env.rb file is pretty simple:

require 'webrat'
include Webrat::Methods
include Webrat::Matchers

Webrat.configure do |config|
  config.mode = :mechanize
end

And if I put something like this in my step definitions:

Given /Debug/ do
  puts response.to_yaml
end

I get this error:

  undefined method `response' for nil:NilClass (NoMethodError)
  ./features/step_definitions/webrat_steps.rb:11:in `/Debug/'
  features/versions.feature:4:in `Given Debug'

Is anyone familiar with this type of situation?

best,

Jacob

A: 

Is there a response_body available?

I'm looking at the cucumber features for the PHP app linked to from the cucumber wiki. They seem to assume they'll have access to a response_body variable . Might be worth checking out their env.rb file as well.

mczepiel