Sha256: 30b66eebe5b27ed644aecffffcfa02d3c8d2fe01a6fb822ccc4cb812445d4bfd

Contents?: true

Size: 661 Bytes

Versions: 1

Compression:

Stored size: 661 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
    mod = Module.new do
      define_method(:included) { |_| included_ancestor = true }
    end
    subject.extend mod
    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.1 spec/unit/axiom/function/unary/invertible/class_methods/included_spec.rb