Sha256: 07dd9723aaf6c2c1e57c30e2072445d5a3b7fe73621db6350ecd3111ad5b3ef2

Contents?: true

Size: 528 Bytes

Versions: 14

Compression:

Stored size: 528 Bytes

Contents

class Module
  def focus *wanteds
    wanteds.map! { |m| m.to_s }
    unwanteds = public_instance_methods(false).grep(/test_/) - wanteds
    unwanteds.each do |unwanted|
      remove_method unwanted
    end
  end

  def focus_re regexp
    focus(*public_instance_methods.grep(regexp))
  end

  def blur
    parent = self.superclass

    ObjectSpace.each_object Class do |klass|
      next unless parent > klass
      next if klass == self

      klass.send :focus
      klass.send :undef_method, :default_test
    end
  end
end

Version data entries

14 entries across 14 versions & 4 rubygems

Version Path
ZenTest-4.8.3 lib/focus.rb
ZenTest-4.8.2 lib/focus.rb
ZenTest-4.8.1 lib/focus.rb
ZenTest-4.8.0 lib/focus.rb
ZenTest-4.7.0 lib/focus.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/ZenTest-4.6.0/lib/focus.rb
SlimZenTest-4.6.2 lib/focus.rb
ZenTest-4.6.2 lib/focus.rb
SlimTest-4.6.1.1 lib/focus.rb
ZenTest-4.6.1 lib/focus.rb
ZenTest-4.6.0 lib/focus.rb
ZenTest-4.5.0 lib/focus.rb
ZenTest-4.4.2 lib/focus.rb
ZenTest-4.4.1 lib/focus.rb