Undefined method assert_select

Posted by Mike Blake Mon, 19 Feb 2007 18:23:00 GMT

The assert_select method for testing views was added in Rails 1.2, so the first thing to check if you’re getting the error below is that you’ve upgraded to 1.2

>  2) Error:
>test_expire_old_ads(AdExpirationTest):
>NoMethodError: undefined method `assert_select' for #
> c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/test_process.rb:432:in `method_missing'

Now I upgraded to 1.2 and still kept getting the above error. The problem was that my application was set to use Rails 1.1.6 in the config/environment.rb file:

# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '1.1.6'

So the solution is to comment out that line, or alternatively ,set it to the latest version. Also make sure you’re not frozen to a specific Rails version in the vendor directory.

Posted in  | Tags , , ,  | no comments