Displaying 2 results from an estimated 2 matches for "mockcontroller".
2006 Jan 10
4
Problem creating MockController
...troller to test the use of UrlHelper in
ActionMailer. I''m trying this:
require
''d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller''
# Re-raise errors caught by the controller.
#class DiscussionsController; def rescue_action(e) raise e end; end
class MockController < ActionController::Base
def initialize
@url = UrlRewriter.new(ActionController::TestRequest.new, nil)
super
end
end
because if I just do require ''action_controller'' I get a no such file error.
Problem with this mock is that I get a recursive error:
SystemStackError: stack l...
2006 Jan 09
1
testing UrlHelper in ActionMailer
...=> ''tree'', :id =>
@discussion %>
so I don''t really need the defaults in the controller @url anyhow.
Any ideas how I can test this thing properly? Create a mock controller
perhaps?
Some method to set the controllers @url variable ...?
I was trying this:
class MockController < ActionController::Base
@url =
ActionController::UrlRewriter.new(ActionController::TestRequest.new, nil)
end
but I keep getting "MissingSourceFile: No such file to load --
url_rewriter" errors - I can''t work out how to pull in the UrlRewriter
class ...
Many thanks in advanc...