[rspec-users] Spec the Application Controller application.rb

Andy Croll lists at ruby-forum.com
Mon Apr 21 11:27:06 EDT 2008

How would I go about writing specs for methods in the Application

I'm thinking of simple methods that do authentication, through before
filters or for example how might I spec this method in an

  def store_location
    session[:return_to] = request.request_uri

The trouble is I'm not generating a request object as the methods are to
be used by all controllers... I've tried stubbing...

request = mock_model(URI::HTTP, :request_uri => "something")

...or setting the variable in the spec itself...

request.response_uri = "something"

...but I can't seem to get the approach right!
Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list