Martinicity: Tag assert_select Mike Blake tag:www.martinicity.net,2005:Typo Typo 2007-02-19T18:27:18+00:00 Mike Blake urn:uuid:6ddf5409-4a21-4502-a1d6-b9dc8733aedc 2007-02-19T18:23:00+00:00 2007-02-19T18:27:18+00:00 Undefined method assert_select <p>The <a href="http://blog.labnotes.org/2006/09/04/assert_select-cheat-sheet/">assert_select</a> method for testing views was added in <a href="http://weblog.rubyonrails.org/2006/11/26/1-2-new-in-actionpack">Rails 1.2</a>, so the first thing to check if you&#8217;re getting the error below is that you&#8217;ve upgraded to 1.2</p> <pre> &gt; 2) Error: &gt;test_expire_old_ads(AdExpirationTest): &gt;NoMethodError: undefined method `assert_select' for #&lt;ActionController::Integration::Session:0x378ae98&gt; &gt; c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/test_process.rb:432:in `method_missing' </pre> <p>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:</p> <div class="typocode"><pre><code class="typocode_ruby "><span class="comment"># Specifies gem version of Rails to use when vendor/rails is not present</span> <span class="constant">RAILS_GEM_VERSION</span> <span class="punct">=</span> <span class="punct">'</span><span class="string">1.1.6</span><span class="punct">'</span></code></pre></div> <p>So the solution is to comment out that line, or alternatively ,set it to the latest version. Also make sure you&#8217;re not frozen to a specific Rails version in the vendor directory.</p>