Panasonic Youth rob sanheim writes about software, business, ruby, music, stuff and things



Posts Tagged TDD

How to Stub ActionController#render for Testing

Sometimes you just want to ensure that render will get called with the correct parameters in a test. Say, for instance, if you have your own special site_render method that examines subdomains or other info about the current request, and then does the real render based on that. This little test helper [...]


Continous Builder gets some Campfire love

I noticed a recent check in on the Rails timeline to the Continuous Builder plugin. DHH has added Campfire integration - so now you can get notified in real time chat about the chump who broke the build, and then proceed to mock them.
Peer pressure can be a powerful thing, so grab [...]


Five Ruby Blogs to Feed Your Head (and Soul)

I subscribe to far too many feeds. I never catch up, and recently somehow blew away my entire "non-ruby programming blogs" folder in NetNewsWire, and didn't really notice (or care).
That said, I think its important to keep up with the Ruby "blogs", as kids call them these days, if only because things [...]


Adding your Lib Tests and Plugin Tests to Autotest

My work lately has involved managing a lot of common code across three different Rails projects, some of it managed by svn:externals in /lib and some in plugins. So since I've been using ZenTest's autotest (which is very nice with the growl and redgreen plugins in 3.4), naturally I want the lib and vendor/plugin [...]


Accessing Rails Configuration and database.yml Programatically

I changed our database.yml to use merge keys, but we have a case where the host is different for production from all the other environments. I wanted to test and ensure the prod db host remained correct with the yaml merge - the docs say it works like hash#merge, but you don't wanna mess [...]


Posted
9 August 2006 @ 2pm

Tagged
Rails, Ruby, TDD

Using Autotest with Integration Tests

Autotest by default doesn't try to do anything with integration tests...since they can test so many files, its impossible to map x controller and z model to a integration test. However, that shouldn't prevent it from at least rerunning an integration test when there are changes to the integration test itself, and also running [...]


Hacking green bar color output into Autotest

update: You don't need to do this hack anymore - the RedGreen plugin is builtin into autotest with the latest versions.
A much welcome upgrade of the indispensable autotest recently came out which speeds things up greatly, but the output was still plain test_unit output. There are now hooks to add plugins to add widgets [...]


Posted
22 July 2006 @ 2am

Tagged
Rails, Ruby, TDD

Testing named routes or url_for in functional test

If you've ever tried using named routes or url_for in functional tests, you might have seen an error like this:
1) Error:
test_article_override_to_meta(ArticleControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
The error occured while evaluating nil.rewrite
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:461:in `url_for'
generated/routing/named_routes/article.rb:2:in `article_url'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/test_process.rb:431:in `method_missing'
[...]


Mick Clark’s Testing Session from Rails Conf

Mike Clark's testing session disappointed me


Posted
14 June 2006 @ 1pm

Tagged
Rails, Ruby, TDD

Testing the ApplicationController in Rails

Not sure why this test case isn't generated right away, but here it is:

require File.dirname(__FILE__) + '/../test_helper'
require 'application'
# Re-raise errors caught by the controller.
class ApplicationController; def rescue_action(e) raise e end; end
class ApplicationControllerTest <Test::Unit::TestCase
 
  def setup
    @controller = ApplicationController.new
  end
 
# your test here
  def test_truth
    assert true
  end
end


← Before After →