-
-
Save iafonov/e224c4cf78102f44c498 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
ActionMailer::Base.class_eval do | |
DELIVERIES_CACHE_PATH = | |
File.join(RAILS_ROOT,'tmp','cache',"action_mailer_cache_deliveries#{ENV['TEST_ENV_NUMBER']}.cache") | |
def perform_delivery_cache(mail) | |
deliveries = File.open(DELIVERIES_CACHE_PATH, 'r') do |f| | |
Marshal.load(f) | |
end | |
deliveries << mail | |
File.open(DELIVERIES_CACHE_PATH,'w') do |f| | |
Marshal.dump(deliveries, f) | |
end | |
end | |
def self.cached_deliveries | |
File.open(DELIVERIES_CACHE_PATH,'r') do |f| | |
Marshal.load(f) | |
end | |
end | |
def self.clear_cache | |
deliveries.clear | |
File.open(DELIVERIES_CACHE_PATH,'w') do |f| | |
Marshal.dump(deliveries, f) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment