Sha256: 722108ef96d7fe89f45718809c28c4461e6c74f1b695482399415962fb666aa7

Contents?: true

Size: 737 Bytes

Versions: 1

Compression:

Stored size: 737 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Adamantium::ModuleMethods, '#original_instance_method' do
  subject { object.original_instance_method(name).source_location }

  let(:object) do
    Class.new do
      include Adamantium

      def foo; end

      const_set(:ORIGINAL, instance_method(:foo).source_location)

      memoize :foo
    end
  end

  context 'when the method was memoized' do
    let(:name) { :foo }

    it 'returns the original method' do
      should eql(object::ORIGINAL)
    end
  end

  context 'when the method was not memoized' do
    let(:name) { :bar }

    it 'raises an exception' do
      expect { subject }
        .to raise_error(ArgumentError, 'No method :bar was memoized')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
adamantium-0.1.0 spec/unit/adamantium/module_methods/original_instance_method_spec.rb