Sha256: 803ac3f8efdadb7588f056bd0a25725495bd026f249816c89ccd30b0e37638bf

Contents?: true

Size: 647 Bytes

Versions: 1

Compression:

Stored size: 647 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Function::Unary::Invertible, '.included' do
  subject { object }

  let(:object) { described_class }
  let(:klass)  { Class.new       }

  before do
    klass.stub(:memoize)
  end

  it 'memoizes the inverse method' do
    klass.should_receive(:memoize).with(:inverse)
    klass.send(:include, subject)
  end

  it 'delegates to the ancestor' do
    included_ancestor = false
    subject.extend Module.new {
      define_method(:included) { |_| included_ancestor = true }
    }
    expect {
      klass.send(:include, subject)
    }.to change { included_ancestor }.from(false).to(true)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axiom-0.1.0 spec/unit/axiom/function/unary/invertible/class_methods/included_spec.rb