Forum: Ruby on Rails assert_template fails?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bcfc926d36e15709d7e6c70b9791211a?d=identicon&s=25 Vamsee Kanakala (Guest)
on 2005-12-18 11:06
(Received via mailing list)
Hi All,

I have a seemingly simple problem - but can't figure out the problem. I
have a simple functional test like so:

  def test_should_show_search_dropdown
    get :index
    assert_response :success
    assert_template :search
  end

Inspite of having search.rhtml in /app/views/layout, it fails with an
error:

  1) Error:
test_should_show_search_dropdown(SearchControllerTest):
NoMethodError: undefined method `include?' for :search:Symbol

/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/assertions.rb:109:in
`assert_template'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/assertions.rb:313:in
`clean_backtrace'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/assertions.rb:108:in
`assert_template'
    test/functional/search_controller_test.rb:17:in
`test_should_show_search_dropdown'

1 tests, 1 assertions, 0 failures, 1 errors

Anybody can tell me where I'm going wrong?

Thanks,
Vamsee.
Ce60c4f78a63b0695e4dafc4bd7964f7?d=identicon&s=25 Lou Vanek (Guest)
on 2005-12-18 15:00
(Received via mailing list)
instead of using a symbol, use a string:

   assert_template 'search'

http://manuals.rubyonrails.com/read/chapter/28
This topic is locked and can not be replied to.