Sha256: f7203ec6fb4f67f49d77b0d067af085966ca9de7b42ff44cbd7bd8bcfbc7d07a
Contents?: true
Size: 1 KB
Versions: 2
Compression:
Stored size: 1 KB
Contents
require File.expand_path(File.dirname(__FILE__) + "/../test_helper") require 'method_cleanout' class MethodCleanoutTest < Test::Unit::TestCase class Victim OriginalMethods = instance_methods include Hardmock::MethodCleanout end def setup @victim = Victim.new end def test_should_remove_most_methods_from_a_class expect_removed = Victim::OriginalMethods.reject { |m| Hardmock::MethodCleanout::SACRED_METHODS.include?(m) } expect_removed.each do |m| assert !@victim.respond_to?(m), "should not have method #{m}" end end def test_should_leave_the_sacred_methods_defined Hardmock::MethodCleanout::SACRED_METHODS.each do |m| assert @victim.respond_to?(m) end end def test_should_include_certain_important_methods_in_the_sacred_methods_list %w|__id__ __send__ send equal? respond_to? nil?|.each do |m| assert Hardmock::MethodCleanout::SACRED_METHODS.include?(m), "important method #{m} is not included in SACRED_METHODS" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hardmock-1.1.0 | test/unit/method_cleanout_test.rb |
hardmock-1.2.0 | test/unit/method_cleanout_test.rb |