我有以下情况,
class Schools::Status
def initialize(school)
@school = school
end
def active?
true
end
end
现在,我想active?
为特定学校存根方法。
拥有这样的一种方法
Schools::Status.new(school).stubs(:active?).returns(false)
但是我的用例不同,我有学校的搜索结果,我想根据active?
以下值过滤该结果:
schools.select { |s| Schools::Status.new(school).active? }
在上述情况下,特别是我想active?
为某些实例存根。