Sha256: 951e2d179b5711a3f813cac23cdaaaf669f1ec2e1b7b1c33865912c1625e5eaa

Contents?: true

Size: 684 Bytes

Versions: 1

Compression:

Stored size: 684 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

  it 'extends the klass' do
    klass.singleton_class.should_not include(described_class::ClassMethods)
    klass.send(:include, subject)
    klass.singleton_class.should include(described_class::ClassMethods)
  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/comparable/class_methods/included_spec.rb