Sha256: cebe68a7859cb84f5bad88b15b0c318899fb5acc0b2afec2ea38aab0b1fb6872

Contents?: true

Size: 642 Bytes

Versions: 6

Compression:

Stored size: 642 Bytes

Contents

require 'abstract_unit'
require 'active_support/core_ext/module/remove_method'

module RemoveMethodTests
  class A
    def do_something
      return 1
    end
    
  end
end

class RemoveMethodTest < ActiveSupport::TestCase
  
  def test_remove_method_from_an_object
    RemoveMethodTests::A.class_eval{
      self.remove_possible_method(:do_something)
    }
    assert !RemoveMethodTests::A.new.respond_to?(:do_something)
  end
  
  def test_redefine_method_in_an_object
    RemoveMethodTests::A.class_eval{
      self.redefine_method(:do_something) { return 100 }
    }
    assert_equal 100, RemoveMethodTests::A.new.do_something
  end

end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
opal-activesupport-0.3.3 test/core_ext/module/remove_method_test.rb
opal-activesupport-0.3.2 test/core_ext/module/remove_method_test.rb
opal-activesupport-0.3.1 test/core_ext/module/remove_method_test.rb
activejob-lock-0.0.2 rails/activesupport/test/core_ext/module/remove_method_test.rb
opal-activesupport-0.3.0 test/core_ext/module/remove_method_test.rb
activejob-lock-0.0.1 rails/activesupport/test/core_ext/module/remove_method_test.rb