File: included_spec.rb

package info (click to toggle)
ruby-memoizable 0.4.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 192 kB
  • sloc: ruby: 605; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 651 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# encoding: utf-8

require 'spec_helper'

describe Memoizable::ModuleMethods, '#included' do
  subject { descendant.instance_exec(object) { |mod| include mod } }

  let(:object)     { Module.new.extend(described_class) }
  let(:descendant) { Class.new                          }
  let(:superclass) { Module                             }

  before do
    # Prevent Module.included from being called through inheritance
    allow(Memoizable).to receive(:included)
  end

  it_behaves_like 'it calls super', :included

  it 'includes Memoizable into the descendant' do
    subject
    expect(descendant.included_modules).to include(Memoizable)
  end
end