Skip to content

Params are empty in view specs #172

@dolzenko

Description

@dolzenko

Params hash is empty in views spec (i.e. no :controller and :action keys) which prevents url_for from generating routes when default controller is assumed.

I originally encountered the problem while trying to spec the view which uses will_paginate (and had to apply solution from [1]). But then browsing through links like [2] and [3] makes it seem like the params hash should be present. At least probably :controller should be set since there is controller detection anyway [4].

So I'm lost now, should I supply params[:controller], params[:action] manually from my views spec or it's a bug in RSpec/Rails?

[1] http://groups.google.com/group/will_paginate/browse_thread/thread/cd8dae9285441343?pli=1
[2] https://rspec.lighthouseapp.com/projects/5645/tickets/488
[3] http://groups.google.com/group/rspec/browse_thread/thread/761a071ead35a616/e6bb3075094d076b
[4] http://github.com/rspec/rspec-rails/blob/master/lib/rspec/rails/example/view_example_group.rb#L120

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions