#395 new
James B. Byrne

assert_select not working with Rails-3.0.0 due to webrat

Reported by James B. Byrne | September 10th, 2010 @ 03:08 PM

Given the following html:

To Proceed Please Authenticate Your Identity


And the following code:

  
  selector = "#authentication_request"
  expected = true
  message = 'Missing authentication_request selector'

  assert_select(selector, expected, message)

With Rails-2.3.8 and Webrat-0.7.1 this test passes.
With Rails-3.0.0 and without webrat installed this test passes.
With Rails-3.0.0 and Webrat-0.7.1 or 0.7.2-beta it fails with this:

      undefined method `content_type' for nil:NilClass (NoMethodError)
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/activesupport-3.0.0/lib/active_support/whiny_nil.rb:48:in `method_missing'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/actionpack-3.0.0/lib/action_dispatch/testing/assertions/selector.rb:605:in `response_from_page_or_rjs'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/actionpack-3.0.0/lib/action_dispatch/testing/assertions/selector.rb:213:in `assert_select'
      /home/byrnejb/Software/Development/Projects/proforma.git/features/app/models/users/step_definitions/user_authentication_steps.rb:64
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/core_ext/instance_exec.rb:48:in `instance_exec'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/core_ext/instance_exec.rb:48:in `cucumber_instance_exec'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/core_ext/instance_exec.rb:69:in `cucumber_run_with_backtrace_filtering'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/core_ext/instance_exec.rb:36:in `cucumber_instance_exec'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/rb_support/rb_step_definition.rb:54:in `invoke'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/step_match.rb:26:in `invoke'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/step_mother.rb:203:in `invoke'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/rb_support/rb_world.rb:22:in `Then'
      /home/byrnejb/Software/Development/Projects/proforma.git/features/app/models/users/step_definitions/user_authentication_steps.rb:94
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/core_ext/instance_exec.rb:48:in `instance_exec'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/core_ext/instance_exec.rb:48:in `cucumber_instance_exec'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/core_ext/instance_exec.rb:69:in `cucumber_run_with_backtrace_filtering'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/core_ext/instance_exec.rb:36:in `cucumber_instance_exec'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/rb_support/rb_step_definition.rb:54:in `invoke'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/step_match.rb:26:in `invoke'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/step_invocation.rb:62:in `invoke'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/step_invocation.rb:41:in `accept'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/tree_walker.rb:99:in `visit_step'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/tree_walker.rb:164:in `broadcast'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/tree_walker.rb:98:in `visit_step'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/step_collection.rb:15:in `accept'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/step_collection.rb:14:in `each'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/step_collection.rb:14:in `accept'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/tree_walker.rb:93:in `visit_steps'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/tree_walker.rb:164:in `broadcast'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/tree_walker.rb:92:in `visit_steps'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/scenario.rb:53:in `accept'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/step_mother.rb:327:in `with_hooks'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/step_mother.rb:348:in `before_and_after'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/step_mother.rb:326:in `with_hooks'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/step_mother.rb:337:in `call'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/step_mother.rb:337:in `around'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/language_support/language_methods.rb:13:in `around'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/language_support/language_methods.rb:95:in `call'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/language_support/language_methods.rb:95:in `execute_around'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/language_support/language_methods.rb:12:in `around'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/step_mother.rb:336:in `around'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/step_mother.rb:334:in `call'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/step_mother.rb:334:in `around'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/step_mother.rb:325:in `with_hooks'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/scenario.rb:51:in `accept'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/scenario.rb:106:in `with_visitor'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/scenario.rb:45:in `accept'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/tree_walker.rb:51:in `visit_feature_element'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/tree_walker.rb:164:in `broadcast'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/tree_walker.rb:50:in `visit_feature_element'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/feature.rb:35:in `accept'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/feature.rb:34:in `each'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/feature.rb:34:in `accept'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/tree_walker.rb:20:in `visit_feature'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/tree_walker.rb:164:in `broadcast'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/tree_walker.rb:19:in `visit_feature'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/features.rb:29:in `accept'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/features.rb:17:in `each'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/features.rb:17:in `each'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/features.rb:28:in `accept'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/tree_walker.rb:14:in `visit_features'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/tree_walker.rb:164:in `broadcast'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/ast/tree_walker.rb:13:in `visit_features'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/cli/main.rb:61:in `execute!'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/../lib/cucumber/cli/main.rb:25:in `execute'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/cucumber-0.8.5/bin/cucumber:8
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/bin/cucumber:19:in `load'
      /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/bin/cucumber:19
      features/app/models/users/admin_user.feature:77:in `And the user named "admin" authenticates'

I infer that Webrat is overriding assert_select in some way but I have no clue as to where, how or why.

Comments and changes to this ticket

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

People watching this ticket

Pages