#141 open
Justin Smestad

merb_cucumber broken with webrat 0.4

Reported by Justin Smestad | January 22nd, 2009 @ 02:33 PM | in 0.4.2

Using merb_cucumber and webrat 0.4 causes any of the result_steps.rb to error with:

undefined local variable or method response' for #<Merb::Test::World::Webrat:0x273d014> (NameError)

This issue does not occur with webrat 0.3.2 I have also contacted david, merb_cucumber developer, about this problem also.

Comments and changes to this ticket

  • Lindsay Holmwood

    Lindsay Holmwood January 23rd, 2009 @ 01:31 AM

    There's been a bit of reworking within Webrat::Methods, and the response method no longer exists.

    I'm guessing you're using response to poke at response body, like this:

    response.body.should <something>
    
    

    There's a method specifically for getting at the response body now, so you can just do:

    response_body.should <something>
    
    

    You can use this quick shell fragment to update your tests:

    cd $your_features_directory
    for step in $(grep response\.body * -R |cut -d ':' -f 1 |uniq); do 
      sed -i 's#response\.body#response_body#' $step
    done
    
    
  • Justin Smestad

    Justin Smestad January 24th, 2009 @ 07:38 PM

    That seemed to solve the problem with response.body.should have_xpath..., but now I need the updated command to do:

    response.should_not be_successful

    Thanks for the help with this :D

  • Bryan Helmkamp

    Bryan Helmkamp January 25th, 2009 @ 04:52 PM

    • Milestone set to 0.4.1
  • Derek Williams

    Derek Williams January 25th, 2009 @ 08:59 PM

    Adding

    @@@ruby def response

    webrat_session.response
    
    

    end

    
    
    to features/support/env.rb in your merb project works, should this be a fix that is added to merb_cucumber? or is there a better solution to this problem?
    
  • Derek Williams

    Derek Williams January 25th, 2009 @ 09:02 PM

    uhm... guess I haven't figured out code blocks on here so well... trying again

    that should have been:

    Adding:

    
    
    def response
        webrat_session.response
    end
    
    

    to features/support/env.rb in your merb project works, should this be a fix that is added to merb_cucumber? or is there a better solution to this problem?

  • Bryan Helmkamp

    Bryan Helmkamp January 26th, 2009 @ 09:49 AM

    • State changed from “new” to “open”

    Derek -- I think that code should be added to merb_cucumber. I've forked merb_cucumber and will be committing that (as well as some other tweaks for Webrat).

  • Derek Williams

    Derek Williams January 26th, 2009 @ 11:56 PM

    After looking over my solution again, I think a better place to add the response method definition would be in:

    
    lib/merb_cucumber/world/webrat.rb
    

    Just after

    
    include Webrat::Methods
    

    This would make the change more transparent to the user, as a generated file wouldn't have to be regenerated to fix this problem for them.

  • Bryan Helmkamp

    Bryan Helmkamp February 8th, 2009 @ 11:22 PM

    • Milestone changed from 0.4.1 to 0.4.2
  • gaffo

    gaffo June 3rd, 2009 @ 10:13 AM

    • Tag changed from integration, merb, merb_cucumber, response, rspec to integration, merb, merb_cucumber, response, rspec, stale

    Derek,
    Is this still an issue?

    Thanks

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Ruby Acceptance Testing for Web applications.

Shared Ticket Bins

Pages