Sha256: 18db0007694413671bcb08dbf734b7bdad220681d67f3e327e3ff440cabf8dda

Contents?: true

Size: 964 Bytes

Versions: 1

Compression:

Stored size: 964 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Adamantium, '.included' do
  let(:object) { described_class }

  subject { object.included(target) }

  let(:included_modules) do
    target.singleton_class.included_modules
  end

  before { subject }

  context 'when target is a module' do
    let(:target) { Module.new }

    it_should_behave_like 'a command method'

    it 'includes Adamantium::ModuleMethods' do
      expect(included_modules).to include(Adamantium::ModuleMethods)
    end

    it 'does not include Adamantium::ClassMethods' do
      expect(included_modules).to_not include(Adamantium::ClassMethods)
    end
  end

  context 'when target is a class' do
    let(:target) { Class.new }

    it 'includes Adamantium::{Class,Module}Methods' do
      expect(included_modules).to include(Adamantium::ModuleMethods)
      expect(included_modules).to include(Adamantium::ClassMethods)
    end

    it_should_behave_like 'a command method'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
adamantium-0.1.0 spec/unit/adamantium/class_methods/included_spec.rb