Sha256: 464b0a7eddc411e7a7203651b2d6fc5e01d66c1803c1e09bada0a83877ec7c9a

Contents?: true

Size: 689 Bytes

Versions: 23

Compression:

Stored size: 689 Bytes

Contents

# encoding: utf-8
gem 'minitest'
require 'minitest/autorun'

require_relative '../lib/sanitize'

# Helper to stub an instance method. Shamelessly stolen from
# https://github.com/codeodor/minitest-stub_any_instance/
class Object
  def self.stub_instance(name, value, &block)
    old_method = "__stubbed_method_#{name}__"

    class_eval do
      alias_method old_method, name

      define_method(name) do |*args|
        if value.respond_to?(:call) then
          value.call(*args)
        else
          value
        end
      end
    end

    yield

  ensure
    class_eval do
      undef_method name
      alias_method name, old_method
      undef_method old_method
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
sanitize-5.0.0 test/common.rb
sanitize-4.6.6 test/common.rb
sanitize-4.6.5 test/common.rb
sanitize-4.6.4 test/common.rb
sanitize-4.6.3 test/common.rb
sanitize-4.6.2 test/common.rb
sanitize-4.6.1 test/common.rb
sanitize-4.6.0 test/common.rb
sanitize-4.5.0 test/common.rb
sanitize-4.4.0 test/common.rb
sanitize-4.3.0 test/common.rb
sanitize-4.2.0 test/common.rb
sanitize-4.1.0 test/common.rb
sanitize-4.0.1 test/common.rb
sanitize-4.0.0 test/common.rb
sanitize-3.1.2 test/common.rb
sanitize-3.1.1 test/common.rb
sanitize-3.1.0 test/common.rb
sanitize-3.0.4 test/common.rb
sanitize-3.0.3 test/common.rb