Sha256: bdc6b6e9092157c53b12a4a838b18d2f4845943135fb95b21e7d89ce2140c46a

Contents?: true

Size: 583 Bytes

Versions: 3

Compression:

Stored size: 583 Bytes

Contents

require 'test_helper'

if RedCard.check '2.0'

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

end # RedCard

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
casting-0.6.3 test/casting_20_test.rb
casting-0.6.2 test/casting_20_test.rb
casting-0.6.1 test/casting_20_test.rb