Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@harvesthq
Created November 30, 2009 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harvesthq/245558 to your computer and use it in GitHub Desktop.
Save harvesthq/245558 to your computer and use it in GitHub Desktop.
Do you have a problem making use of a Rails' default migration generation
logic's inclusion of your test_helper?
require 'test_helper'
Do you have to replace it with?
require File.dirname(__FILE__) + '/../test_helper'
Manually? Every time? Annoyed?
Your problem might be using aliases in your test_helper. It seems test_helper
is loaded twice, and these aliases get into a circular loop. See a workaround
below.
class Test::Unit::TestCase
def run_with_some_added_features(*args, &block)
# added feature code
run_without_some_added_features(*args, &block)
end
unless defined?(TestHelperWasLoadedOnceAlready)
alias_method_chain :run, :some_added_features
end
end
class TestHelperWasLoadedOnceAlready
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment