Failing Test Case for Issue #1692 Routes not found in TestRequest#assign_parameters #1693

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@janv

I have encountered (probably) the following problem in a 2.3.12 app:

We have a route with :method => :post

In our controller test, calling post action, … fails unless I explicity set a :format => :post parameter although that should have been inferred by the assign_parameters method.

The reason for this is, as far as I figured out:
assign_parameters calls Route#extra_keys
_extra_keys calls RouteSet#generate_extras
__which in turn calls route_generate_raw
__which doesn't return a path
_which causes RouteSet#generate to raise a RoutingError

I'm not sure where exactly to fix this problem.
I'd simply add a line or two to assign_parameters that adds the :format to the options but I'm happy to implement other suggestions.

See issue #1692

@pixeltrix
Ruby on Rails member

You're not defining the route correctly - this test passes:

  def test_routing_with_method
    with_routing do |set|
      set.draw { |map| map.connect 'testmethod', :controller => 'test_test/test', :action => 'create', :conditions => { :method => :post } }
      assert_nothing_raised {
        post :create
      }
    end
  end
@pixeltrix pixeltrix closed this Jun 14, 2011
@janv

Ooops, you're right. Sorry.

@jake3030 jake3030 pushed a commit to jake3030/rails that referenced this pull request Jun 28, 2011
@lifo lifo Add expiry support File cache store [#1693 state:resolved] [Roman Sht…
…erenzon, Pratik Naik]
b5775c2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment