# DATE\_FORMATS and functional tests

**URL:** <https://www.ruby-forum.com/t/date-formats-and-functional-tests/118995>\
**Category:** Rails\
**Created:** [November 2, 2007, 1:00am UTC](https://www.ruby-forum.com/t/date-formats-and-functional-tests/118995 "2007-11-02T01:00:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sp00nyg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/edb3f5/32.png) [@sp00nyg](https://www.ruby-forum.com/u/sp00nyg)\
**Post date:** [November 2, 2007, 1:00am UTC](https://www.ruby-forum.com/t/date-formats-and-functional-tests/118995/1 "2007-11-02T01:00:41Z")

</div>

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?
