Cucumber response object -- PHP environment
        Posted  
        
            by trisignia
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by trisignia
        
        
        
        Published on 2010-01-08T13:52:35Z
        Indexed on 
            2010/04/17
            0:13 UTC
        
        
        Read the original article
        Hit count: 668
        
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
© Stack Overflow or respective owner