Sha256: afd57bb70f906a312d04cef4e10a182575c5dbfe88f3b8029849941099854ad6

Contents?: true

Size: 764 Bytes

Versions: 1

Compression:

Stored size: 764 Bytes

Contents

require 'spec_helper'
require 'timeout'

module ExampleMod
  def mod; :mod; end
end

describe Uninclude do
  let(:klass) {
    Class.new do
    end
  }
  let(:instance) { klass.new }

  describe '.uninclude' do
    it 'should uninclude module' do
      klass.class_eval { include ExampleMod }
      instance.should respond_to(:mod)
      klass.class_eval { uninclude ExampleMod }
      instance.should_not respond_to(:mod)
    end

    it 'should not infinite loop' do
      klass.class_eval { uninclude(Module.new) }
    end
  end

  describe '#unextend' do
    it 'should unextend module' do
      instance.extend(ExampleMod)
      instance.should respond_to(:mod)
      instance.unextend(ExampleMod)
      instance.should_not respond_to(:mod)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
uninclude-1.0.1 spec/uninclude_spec.rb