requiring javascript_helper outside rails December 30, 2008
Posted by John Dewey in Code, Example, TestUnit.add a comment
I wanted to fix the tests for css_browser_selector, when updating it to support a rails 2.2.0 change with concat.
However, I would get the following error.
>> require 'action_view/helpers/javascript_helper' TypeError: wrong argument type Symbol (expected Proc)
As it turns out you must require ActiveSupport first, since the JavaScriptHelper requires Sym#to_proc.
Also, ActionView::Helpers::JavascriptHelper alias was removed – yay tests!
Am I rspec-tarded? December 29, 2008
Posted by John Dewey in Code, Example, RSpec, Ruby.1 comment so far
So I want to test the xml declaration and xhtml doctype of my application layout.
I ended up with this pastie.
Does anyone know of a way to accomplish this using rspec’s have_tag/with_tag? I’m not too fond of the regexp solution in the pastie.
Rails log rotations via rsyslog December 25, 2008
Posted by John Dewey in Code, Configuration, Deployment, Example, Rails.2 comments
I have a client that logs their rails logs via syslog, for consumption by pl_analyze. I am not a fan of this, and will probably change it at some point. When using Apache, I’ll typically configure rails to use a rotatelogs pipe.
However, in this case, to avoid changing legacy infrastructure around the logs, I setup rsyslog to do the rotations for me. Hopefully this will be useful to someone else.
This assumes your rails app already logs to syslog.
Added the following to /etc/rsyslog.conf.