> but I'm obviously misunderstanding what's going on in method_added, since
> this method doesn't appear to be getting run.

A bit of extra logging cleared this one up for me. Here is a bit of a
hack to get this working:

      def self.method_added(method)
        case method.to_s
        when 'setup'
          # edit to prevent overriding the setup method created if
setup_before_fixtures method defined
          unless method_defined?(:setup_without_fixtures) ||
method_defined?(:setup_after_user_setup)
            alias_method :setup_without_fixtures, :setup
            define_method(:setup) do
              setup_with_fixtures
              setup_without_fixtures
            end
          end
        when 'teardown'
          unless method_defined?(:teardown_without_fixtures)
            alias_method :teardown_without_fixtures, :teardown
            define_method(:teardown) do
              teardown_without_fixtures
              teardown_with_fixtures
            end
          end
        when 'setup_before_fixtures'
          # add some processing prior to loading fixtures
          unless method_defined?(:setup_after_user_setup)
            alias_method :setup_after_user_setup, :setup
            define_method(:setup) do
              setup_before_fixtures
              setup_after_user_setup
            end
          end
        end
      end

In your test case, define method 'setup_before_fixtures' and the code
will get run before the fixtures. If you also want to add some setup
code that runs after the fixtures are loaded, you still can, by
defining method 'setup' before you define
'setup_before_fixtures' (yes, I know that's really horrible).


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to