0
我有这个与工作...测试(RSpec的)一个类中的模块(红宝石,Rails)的
class LegoFactory # file_num_one.rb
include Butter # this is where the module is included that I want to test.
include SomthingElse
include Jelly
def initialize(for_nothing)
@something = for_nothing
end
end
class LegoFactory # file_num_2.rb
module Butter
def find_me
# test me!
end
end
end
所以,当LegoFactory.new( “你好”),我们得到find_me方法实例化的LegoFactory的一个实例方法。
但是,这里有很多模块,我只是想分开黄油模块,而没有实例化LegoFactory类。
我想测试LegoFactory内ONLY的黄油模块。名称由这个例子组成。
可以这样做吗?
注意:我不能重构代码库,我必须使用我的工作。我只想测试单个模块,而不需要复杂的LegoFactory类和其他包含的模块。