Sha256: 060ecfa2892b69deb12fdc29a2e5eb40083f8a4934b46adb68ea420351af324c

Contents?: true

Size: 735 Bytes

Versions: 4

Compression:

Stored size: 735 Bytes

Contents

require 'spec_helper'

describe Anima, '#included' do
  let(:object) { described_class.new(:foo) }

  let(:target) do
    object = self.object
    Class.new do
      include object
    end
  end

  let(:value) { mock('Value') }

  let(:instance)   { target.new(:foo => value) }
  let(:instance_b) { target.new(:foo => value) }
  let(:instance_c) { target.new(:foo => mock('Bar')) }

  context 'on instance' do
    subject { instance }

    its(:foo) { should be(value) }

    it { should eql(instance_b) }
  end

  context 'on singleton' do
    subject { target }

    it 'should define attribute hash reader' do
      target.attributes_hash(instance).should eql(:foo => value)
    end

    its(:anima) { should be(object) }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
anima-0.0.6 spec/unit/anima/included_spec.rb
anima-0.0.5 spec/unit/anima/included_spec.rb
anima-0.0.4 spec/unit/anima/included_spec.rb
anima-0.0.3 spec/unit/anima/included_spec.rb