我目前正在寫一個非常簡單的開始到測試工具。這個想法是,你可以有包含我的「可測試」模塊的類。例如:功能羨慕當在模塊中混合
class Veilus
include Testable
end
site = Veilus.new
可測試模塊有以下幾點:
module Testable
module_function
def included(caller)
caller.extend Testable::Interface::Page::Attribute
caller.__send__ :include, Testable::Interface::Page
end
end
當臭佬檢查出這個文件,它返回:
FeatureEnvy: Testable#included refers to 'caller'
more than self (maybe move it to another class?)
但不是點的那一個包含的方法?
我意識到我可以將Reek的這個方面的檢查關閉,但我很好奇我將如何遵循其建議在這裏?在這種情況下,這個班級不是我會知道的一段時間。其他人編寫的類將包括我的模塊。
同樣,我知道我可以關閉支票,但似乎我可能想要在其他情況下的支票。於是我開始懷疑,或許我正在做「mixin」方法錯誤,這就是Reek指出的。