Sha256: 2fc1e64382207174e67d154b9a5be96c15bc05d7f5d62f889403f85badf0e6e9

Contents?: true

Size: 889 Bytes

Versions: 2

Compression:

Stored size: 889 Bytes

Contents

require 'spec_helper'
require 'concerned_inheritance'

describe ConcernedInheritance do

  let(:klass) do
    Class.new do
      extend ConcernedInheritance
    end
  end

  describe '.extended' do
    context 'on a module' do
      it 'should extend ModuleMethods' do
         Module.new.extend(ConcernedInheritance).singleton_class.ancestors.should include ConcernedInheritance::ModuleMethods
      end
    end

    context 'on a class' do
      it 'should extend ClassMethods' do
        Class.new.extend(ConcernedInheritance).singleton_class.ancestors.should include ConcernedInheritance::ClassMethods
      end
    end
  end

  describe '.define_inherited_callback' do
    it 'should include the callback' do
      block = Proc.new { }
      klass.send :define_inherited_callback, &block
      klass.instance_variable_get(:@inherited_callbacks).should include block
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
concerned_inheritance-0.0.2 spec/concerned_inheritance_spec.rb
concerned_inheritance-0.0.1 spec/concerned_inheritance_spec.rb