Better settings coupling with spec coverage

This commit is contained in:
2015-02-20 11:51:35 +01:00
parent adeedb2f1b
commit cde551dc7f
6 changed files with 102 additions and 19 deletions
+19
View File
@@ -3,3 +3,22 @@ class NilClass
false
end
end
module MethodPrependAndAppend
def before_method(m, &blk)
alias_method :"#{m}_before_extending", m
define_method m do
instance_eval(&blk)
send :"#{m}_before_extending"
end
end
def after_method(m, &blk)
alias_method :"#{m}_before_extending", m
define_method m do
result = send :"#{m}_before_extending"
instance_eval(result, &blk)
end
end
end
Class.send :include, MethodPrependAndAppend