Sha256: fcc141f01765dc312bb8e40533e6b4fc2aeb122eb32c4f6bc822da5c8cdf14fe

Contents?: true

Size: 724 Bytes

Versions: 11

Compression:

Stored size: 724 Bytes

Contents

# encoding: utf-8

require 'spec_helper'
require File.expand_path('../fixtures/classes', __FILE__)

describe TTY::Delegatable do
  let(:target)      { :test }
  let(:methods)     { [:output] }
  let(:object)      { Class.new(DelegetableSpec::Object)}
  let(:delegatable) { object.new }

  subject { object.delegatable_method target, *methods }

  it 'creates a method #output' do
    expect { subject }.to change { delegatable.respond_to?(:output) }.
      from(false).
      to(true)
  end

  it 'delegates #output to target' do
    subject
    instance = spy(:target_spec)
    allow(TargetSpec::Object).to receive(:new).and_return(instance)

    delegatable.output
    expect(instance).to have_received(:output)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
tty-0.5.0 spec/tty/support/delegatable_spec.rb
tty-0.4.0 spec/tty/support/delegatable_spec.rb
tty-0.3.2 spec/tty/support/delegatable_spec.rb
tty-0.3.1 spec/tty/support/delegatable_spec.rb
tty-0.3.0 spec/tty/support/delegatable_spec.rb
tty-0.2.1 spec/tty/support/delegatable_spec.rb
tty-0.2.0 spec/tty/support/delegatable_spec.rb
tty-0.1.3 spec/tty/support/delegatable_spec.rb
tty-0.1.2 spec/tty/support/delegatable_spec.rb
tty-0.1.1 spec/tty/support/delegatable_spec.rb
tty-0.1.0 spec/tty/support/delegatable_spec.rb