Displaying 1 result from an estimated 1 matches for "anonymousclass".
2007 Aug 07
2
stubs which yield and return
Is there any reason why a stub couldn''t both yield and return? I''m
looking for a way to mock out a class I''ve made named "AnonymousClass":
class AnonymousClass
def initialize(&blk)
@klass = Class.new
@klass.instance_eval(&blk) if block_given?
end
def new
@klass.new
end
def evaluate(&blk)
@klass.instance_eval(&blk)
end
attr_reader :klass
alias_method :class, :klass...