Cucumber response object -- PHP environment
- by trisignia
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