Created
February 23, 2011 19:16
-
-
Save cassiomarques/840969 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using Rspec 2.5.0 + Spork | |
# | |
# Before the hack: | |
# 2131/2131: 100% |==========================================| Time: 00:02:26 | |
# | |
# After the hack: | |
# 2131/2131: 100% |==========================================| Time: 00:02:09 | |
# spec/spec_helper.rb (simplified...) | |
# Adapted from http://37signals.com/svn/posts/2742-the-road-to-faster-tests | |
module FasterTests | |
def scrub_instance_variables | |
reserved_ivars = %w(@loaded_fixtures @test_passed @fixture_cache @method_name @_assertion_wrapped @_result) | |
(instance_variables - reserved_ivars).each do |ivar| | |
instance_variable_set(ivar, nil) | |
end | |
end | |
end | |
RSpec.configure do |config| | |
config.include FasterTests | |
config.before(:all) { scrub_instance_variables } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment