#73 ✓resolved
Zach Dennis

undefined method visits

Reported by Zach Dennis | November 25th, 2008 @ 12:34 PM

Today I upgraded to the latest webrat and got the following issue when running cucumber features. This is using the most current cucumber commit and the most current webrat commit:


undefined method `visits' for #<ActionController::Integration::Session:0x60336ac>

Some other folks in IRC have been experiencing the same issue. Any ideas?

Comments and changes to this ticket

  • magpieuk

    magpieuk November 25th, 2008 @ 12:39 PM

    Running latest Cucumber 0.1.10 gem and getting the same problem with webrat 0.3.2, 0.3.1 and 0.3.0. Webrat gem 0.2.0 works.

  • gaffo

    gaffo November 25th, 2008 @ 03:47 PM

    I can confirm this as well. The delegate_to_session'd method from methods.rb are not showing up in IntegrationTest::Session so the method missing is not calling over to them.

    -Mike

  • Bryan Helmkamp

    Bryan Helmkamp November 25th, 2008 @ 05:50 PM

    Ack. Here's what you need to add (assuming you're using Rails):

    
    require "webrat/rails"
    

    I removed the auto-loading of webrat/rails to make the Webrat mode support (to help with the in-progress Selenium work) work.

    Sorry for the inconvenience.

  • Bryan Helmkamp

    Bryan Helmkamp November 25th, 2008 @ 06:01 PM

    BTW, in the future, for non-backwards compatible changes like this, I'll post alerts to the mailing list:

    http://groups.google.com/group/w...

    ...Just like I'm going to do as soon as I get home from work tonight. :)

    Please subscribe to that list if you use non-release versions of Webrat.

    Thanks,

    -Bryan

  • gaffo

    gaffo November 25th, 2008 @ 07:10 PM

    that fixed it for me. thanks!

  • magpieuk

    magpieuk November 26th, 2008 @ 04:05 AM

    Thanks for that, It working now.

  • Bryan Helmkamp

    Bryan Helmkamp December 1st, 2008 @ 08:24 PM

    • State changed from “new” to “resolved”

    I posted about this change on the mailing list:

    http://groups.google.com/group/w...

    As far as I know, there are no outstanding issues with this, so I'm going to mark it as closed. If anyone experiences Webrat loading issues with the latest code (when using Webrat as either a gem or a plugin), please reopen this.

    Thanks,

    -Bryan

  • Francisco Trindade

    Francisco Trindade February 10th, 2009 @ 11:24 AM

    Hi,

    I've also upgraded from webrat 0.3.4 to 0.4.1 and ran into the same problem. When adding the "require 'webrat/rails'" line, the problem with "visits" goes away, but Im still getting the same error message for "current_scope".

    Failed:

    Any idea why?

    Regards, Francisco

    1) undefined method current_scope' for #<ActionController::Integration::Session:0x20c3148> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/test_process.rb:471:inmethod_missing' /Library/Ruby/Gems/1.8/gems/rspec-1.1.11/lib/spec/matchers.rb:155:in method_missing' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/integration.rb:498:insend' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/integration.rb:498:in method_missing' ./features/webrat_steps/generic_then_steps.rb:18:inThen /^the "(.*)" should look like$/' features/done/items_webrat.feature:27:in Then the "items-list" should look like'

  • Zach Dennis

    Zach Dennis February 10th, 2009 @ 11:43 AM

    Franciso, what does your env.rb file look like? Do you have Webrat configured?

    
    Webrat.configure do |config|
      config.mode = :rails
    end
    
  • Francisco Trindade

    Francisco Trindade February 10th, 2009 @ 11:58 AM

    Yes, it does.... here is how it looks like

    ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(FILE) + '/../../config/environment')

    require 'cucumber/rails/world' require 'cucumber/rails/rspec' require 'webrat/rspec-rails'

    require 'factory_girl' require 'spec/factories' require 'webrat/rails'

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

    Cheers, Francisco

  • Francisco Trindade

    Francisco Trindade February 10th, 2009 @ 11:59 AM

    Now better formatted ;)

    
    
    ENV["RAILS_ENV"] = "test" 
    require File.expand_path(File.dirname(FILE) + '/../../config/environment')
    
    require 'cucumber/rails/world' 
    require 'cucumber/rails/rspec' 
    require 'webrat/rspec-rails'
    
    require 'factory_girl' 
    require 'spec/factories' 
    require 'webrat/rails'
    
    Webrat.configure do |config| 
      config.mode = :rails 
    end
    
    
  • gaffo

    gaffo February 10th, 2009 @ 12:59 PM

    change require 'webrat/rails' to require 'webrat'

  • Francisco Trindade

    Francisco Trindade February 11th, 2009 @ 06:01 AM

    Hi gaffo,

    thanks for your reply. Unfortunately I've tried and still get the same behavior.

    Regards, Francisco

  • Francisco Trindade

    Francisco Trindade February 11th, 2009 @ 09:14 AM

    the output...

    
    
    ailed:
    
    1)
    undefined method `current_scope' for #<ActionController::Integration::Session:0x2074214>
    /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/test_process.rb:471:in `method_missing'
    /Library/Ruby/Gems/1.8/gems/rspec-1.1.11/lib/spec/matchers.rb:155:in `method_missing'
    /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/integration.rb:498:in `__send__'
    /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/integration.rb:498:in `method_missing'
    ./features/steps/generic_then_steps.rb:18:in `Then /^the "(.*)" should look like$/'
    features/done/items.feature:27:in `Then the "items-list" should look like'
    
    
    
  • Bryan Helmkamp

    Bryan Helmkamp February 11th, 2009 @ 09:59 AM

    • State changed from “resolved” to “open”

    Francisco -- can you please paste the code from generic_then_steps.rb?

  • Francisco Trindade

    Francisco Trindade February 11th, 2009 @ 10:07 AM

    Bryan,

    the method Im trying to execute is this one:

    
    
    Then(/^the "(.*)" should look like$/) do |table_id, definition_table|
      column_headers = []
      current_scope.dom.search("//table[@id='#{table_id}']//th").each { |h| column_headers << h.text.strip }
      
      if column_headers.size == 0
        raise "table #{table_id} wasn't found! 8-B"
      end
    
      definition_table.raw[0].each do |definition_header|
        column_headers.should include(definition_header)
      end
    
      definition_table.hashes.each_with_index do |definition_table_row, row_index|
        
        if current_scope.dom.search("//table[@id='#{table_id}']/tbody")
          html_row = current_scope.dom.search("//table[@id='#{table_id}']/tbody/tr[#{row_index + 1}]/td")
        else
          html_row = current_scope.dom.search("//table[@id='#{table_id}']//tr[#{row_index + 2}]/td")
        end
    
        column_headers.each_with_index do |header, column_index|
          unless definition_table_row[header].nil?
            raise "column #{header} was nil, but should have been #{definition_table_row[header]}" if html_row[column_index].nil?
            html_row[column_index].text.strip.should =~ Regexp.new(definition_table_row[header], Regexp::MULTILINE)
          end
        end
      
      end
    end
    
    
  • Bryan Helmkamp

    Bryan Helmkamp June 14th, 2009 @ 10:18 PM

    • State changed from “open” to “resolved”

    I believe the issue documented here has been resolved in master, so I'm going to go ahead and close this out.

    Francisco -- If you're still seeing issues, can you please open a new ticket and we'll try to help? Please provide your env.rb and the full exception if that's the case. Thanks.

    Cheers,

    -Bryan

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

Tags

Pages