I have the following in my environments.rb file:
my_formats = { :msc => ‘%d %b %Y %I:%M %p’, :msc_short => ‘%d %b %Y’ }
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!
(my_formats)
ActiveSupport::CoreExtensions::Conversions::DATE_FORMATS.merge!
(my_formats)
With this, things like ‘invite.created_at.to_s(:msc_short)’ work
perfectly in all my views during normal operation. However, any
functional test that includes a view template with .to_s(:msc) fails
with something like:
ActionView::TemplateError: wrong number of arguments (1 for 0)
On line #20 of app/views/admin/invitation_requests.rhtml
20: <td><%= invite.created_at.to_s(:msc_short) %></td>
My functional test method is:
def test_invitation_requests
login_as :quentin
get :invitation_requests # <— Fails here
assert_response :success
assert assigns(:invites)
end
My test_helper.rb file has the following at the the top:
ENV[“RAILS_ENV”] = “test”
require File.expand_path(File.dirname(FILE) + “/…/config/
environment”)
require ‘test_help’
I figure that should have loaded my environment, but I’m still stuck
with any template that includes .to_s(:msc) fails with a wrong number
of arguments error.
Am I missing something?