Reloadable mocked-out classes

Posted by Jason Garber Thu, 18 May 2006 22:39:00 GMT

If you have a “mock object” in test/mocks/development that requires the object you’re mocking, it won’t be reloaded each request like you’d expect in the development environment. That’s because you’re using require instead of load. Try instead:
load "#{RAILS_ROOT}/app/helpers/application_helper.rb"
Or if you really want to get fancy, use require_or_load.

Asprin for Lighttpd+fcgi: Use spawner

Posted by Jason Garber Thu, 11 May 2006 13:09:00 GMT

I’m late to the spawner party but finally made the move after lots of trouble with static fcgi processes. Jamis blogged about the difference between the two. My problem was that lightty couldn’t find the socket and would fill my error log (and hard drive!) telling me so. Fortunately, when this happened only my Rails app went down; the static sites stayed up.

I feared this spinner/spawner/reaper stuff, but fortunately in Rails 1.1 it’s as simple as:

./script/process/spawner -i 2 -r 10 (I only wanted two instances and wanted spawner to repeat spawn attempts every 10 seconds)

and changing my static fcgi conf (socket, bin-path, bin-environment, max-procs, min-procs, etc.) to this instead:
fastcgi.server = ( ".fcgi" =>
    ( "localhost-8000" => ( "host" => "127.0.0.1", "port" => 8000 ) ), 
    ( "localhost-8001" => ( "host" => "127.0.0.1", "port" => 8001 ) )
)

Best of all, my rc.d script works once again!

rjb + jt400.jar : success!

Posted by Jason Garber Wed, 03 May 2006 14:27:00 GMT

Yesterday I successfully connected to our AS/400 from Ruby by following Darren Day’s instructions over at Mission Data.

Key differences I found when setting it up on OS X:
  • You do have to set JAVA_HOME before installing rjb (set it to /Library/Java/Home)
  • I had to
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JAVA_HOME/jre/lib/i386:$JAVA_HOME/jre/lib/i386/client.
    I didn’t need to set the JavaVM.framework/Libraries symlink.
  • test.rb didn’t fail test_underscored_constant
  • Obvious, but I missed it the first time when cutting & pasting: refer to the right path when doing your Rjb::load. Either way it returns nil.

HigherEd BlogCon

Posted by Jason Garber Wed, 03 May 2006 14:17:00 GMT

Last month’s HigherEd BlogCon was a success and had lots of good presentations. I felt fortunate to be among them. I only wish I had had enough time to watch each one as they came out. I’m still playing catch-up.

Older posts: 1 2 3 4 5 ... 10