Sha256: abde7118da1f3f37e546215af2243c63c5dde430dba64a8627425ccf9f1acc1f

Contents?: true

Size: 432 Bytes

Versions: 4

Compression:

Stored size: 432 Bytes

Contents

# Scrub instance variables as in
# http://37signals.com/svn/posts/2742-the-road-to-faster-tests

ActiveSupport::TestCase.class_eval do
  teardown :scrub_instance_variables

  @@reserved_ivars = %w(@loaded_fixtures @test_passed @fixture_cache @method_name @_assertion_wrapped @_result)

  def scrub_instance_variables
    (instance_variables - @@reserved_ivars).each do |ivar|
      instance_variable_set(ivar, nil)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hermes-0.5.1 lib/hermes/perf/scrub.rb
hermes-0.5.0 lib/hermes/perf/scrub.rb
hermes-0.4.1 lib/hermes/perf/scrub.rb
hermes-0.4.0 lib/hermes/perf/scrub.rb