I have below case,
class Schools::Status
def initialize(school)
@school = school
end
def active?
true
end
end
Now, I want to stub active?
method for a specific school.
One way to have like this
Schools::Status.new(school).stubs(:active?).returns(false)
But my use case is different, I have search result of schools and I want to filter that result based on active?
value as below:
schools.select { |s| Schools::Status.new(school).active? }
In above case, specifically I want to stub active?
for certain instance.