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
require 'celluloid/autostart' | |
class ExceptionHandler | |
def self.notify(e) | |
puts "Something has gone wrong" unless Thread.current[:context] | |
end | |
end |
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
class User < ActiveRecord::Base | |
belongs_to :account | |
#A number of methods giving this class too many responsibilities already | |
end | |
class Account < ActiveRecord::Base | |
# t.integer credits | |
def add_credit(amount) |
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
class SuperStubbedClass; end | |
class ClassStubber | |
def self.stub!(class_string) | |
classes = class_string.split('::') | |
parent_klass = Object | |
classes.each do |class_name| | |
define_if_not_already(class_name, parent_klass) | |
parent_klass = parent_klass.const_get(class_name) | |
end |