Created
November 17, 2011 18:24
-
-
Save Jaym3s/1373996 to your computer and use it in GitHub Desktop.
Database Garbage collection for cucumber
This file contains hidden or 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
module Cucumber | |
RETAINED_OBJECTS_FOR_CUCUMBER = [] | |
end | |
Before('@release') do | |
module ActiveRecord | |
class Base | |
def create_with_cucumber *args | |
Cucumber::RETAINED_OBJECTS_FOR_CUCUMBER << self | |
create_without_cucumber *args | |
end | |
alias_method_chain :create, :cucumber | |
end | |
end | |
end | |
After('@release') do | |
Cucumber::RETAINED_OBJECTS_FOR_CUCUMBER.each do |obj| | |
obj.destroy | |
end | |
Cucumber::RETAINED_OBJECTS_FOR_CUCUMBER = [] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment