Stub ActionController::Base#params

Has anyone had any success stubbing ActionController::Base#params? The
following is not intercepting calls to params[:foo] in my controllers:

ActionController::Base.stub!(:params).and_return(:foo => ‘bar’)

Nevermind! I figured out that (in my case) I simply needed to
instantiate an
instance of ActionController::Base and then stub the methods on the
@controller =
@controller.stub!(:params).and_return(:foo => ‘bar’)

I then run my expectations against @controller, whereas before I was
each of my expectations against a new instance of ActionController::Base

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs