require 'spec' Spec::Example::ExampleGroup.class_eval do def remove_constants *args args = args.first if args.size == 1 and args.first.is_a?(Array) # args.each{|c| raise "Invalid constant name '#{c}'!" unless c =~ /^[a-z_][a-z_0-9]*$/i} # args = args.first if args.first.is_a?(Array) args.each{|c| Object.send :remove_const, c if Object.const_defined? c} end end