Sha256: 1c8add0738d42a246a527c71aa686da6c3c451501572cf4f4f340f668cf9e969

Contents?: true

Size: 544 Bytes

Versions: 3

Compression:

Stored size: 544 Bytes

Contents

require 'test_helper'

describe Casting::Delegation do

  it 'finds the module defining a method and uses it to delegate' do
    client = test_person
    attendant = Unrelated.new
    delegation = Casting::Delegation.new('unrelated', client).to(attendant)
    assert_equal attendant.unrelated, delegation.call
  end

  it 'does not delegate to methods defined in classes' do
    client = test_person
    attendant = Unrelated.new
    assert_raises(TypeError){
      Casting::Delegation.new('class_defined', client).to(attendant)
    }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
casting-0.7.2 test/casting_20_test.rb
casting-0.7.1 test/casting_20_test.rb
casting-0.7.0 test/casting_20_test.rb