So I found a helpful web page that explained how I could use things like
url_for in my mails:
However, I can’t test them properly. The problem is that when I create a
controller in my unit tests and pass it into the ActionMailer, it’s not
a real controller, set up as a controller is when it is instantiated via
an http request, so variables inside the controller like @url are not
set, meaning the test based version of the mail fails.
What I’m trying to do in the mail is something like this:
<%= url_for :controller => ‘discussions’, :action => ‘tree’, :id =>
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
Some method to set the controllers @url variable …?
I was trying this:
class MockController < ActionController::Base
but I keep getting “MissingSourceFile: No such file to load –
url_rewriter” errors - I can’t work out how to pull in the UrlRewriter
Many thanks in advance.