Sha256: 99b21a1c41d617672884b4d67cae1a163a9fcc9bedf4552c5850aa21968400a5

Contents?: true

Size: 586 Bytes

Versions: 14

Compression:

Stored size: 586 Bytes

Contents

module RemoveMethodSpec
  class A
    def do_something
      return 1
    end
  end
end

describe "module" do
  describe "remove_method" do
    it "should remove a method from an object" do
      RemoveMethodSpec::A.class_eval {
        self.remove_possible_method(:do_something)
      }
      RemoveMethodSpec::A.new.should.not.respond_to :do_something
    end

    def test_redefine_method_in_an_object
      RemoveMethodSpec::A.class_eval {
        self.redefine_method(:do_something) { return 100 }
      }
      RemoveMethodSpec::A.new.do_something.should == 100
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
motion-support-1.2.1 spec/motion-support/core_ext/module/remove_method_spec.rb
motion-support-1.1.1 spec/motion-support/core_ext/module/remove_method_spec.rb
motion-support-1.2.0 spec/motion-support/core_ext/module/remove_method_spec.rb
motion-support-1.1.0 spec/motion-support/core_ext/module/remove_method_spec.rb
motion-support-1.0.0 spec/motion-support/core_ext/module/remove_method_spec.rb
motion-support-0.3.0 spec/motion-support/core_ext/module/remove_method_spec.rb
motion_blender-support-0.2.8 spec/motion-support/core_ext/module/remove_method_spec.rb
motion_blender-support-0.2.7 spec/motion-support/core_ext/module/remove_method_spec.rb
motion-support-0.2.6 spec/motion-support/core_ext/module/remove_method_spec.rb
motion-support-0.2.5 spec/motion-support/core_ext/module/remove_method_spec.rb
motion-support-0.2.4 spec/motion-support/core_ext/module/remove_method_spec.rb
motion-support-0.2.3 spec/motion-support/core_ext/module/remove_method_spec.rb
motion-support-0.2.2 spec/motion-support/core_ext/module/remove_method_spec.rb
motion-support-0.2.0 spec/motion-support/core_ext/module/remove_method_spec.rb