This project is archived and is in readonly mode.

#4390 ✓committed

[PATCH] assert_recognizes should work in Integration Tests

Reported by MatthewRudy | April 14th, 2010 @ 05:57 AM | in 3.0.2

this was still working in beta1
(but broke in beta2... which I didn't get round to try)


here's the example of my use

class RoutingTest < ActionDispatch::IntegrationTest
  test "/projects" do
    assert_recognizes({:controller => "projects", :action => "index"}, "/projects")
    assert_recognizes({:controller => "projects", :action => "show", :id => "23"}, "/projects/23")


I tend to do these routing tests as an integration test... as that's kind of what they are.
but since beta2 this gives the following error

  NoMethodError: undefined method recognize_path' for nil:NilClass

As you can see this error is kind of obscure,
but comes from the fact that @routes is not set by default in an IntegrationTest

Its possible that this kind of test shouldn't be possible
(I'm kind of testing controller structure, whereas it could be argued that integration tests are supposed to be independent of this type of thing...)

I think either this patch should be applied
or the RoutingAssertions should not be included into IntegrationTest
(seems like a bad idea to have an assertion that will never work)

here is my patch

and attached also

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

Shared Ticket Bins

Referenced by