Sha256: 8242f18d516cdf8d04dd3e4bf3b2b45c98965417a6fa1a8d1aa191dc8c5f2770

Contents?: true

Size: 652 Bytes

Versions: 3

Compression:

Stored size: 652 Bytes

Contents

require 'test_helper'

module AnyWay
  def which_way
    "any way"
  end
end

module ThisWay
  include Casting::SuperDelegate
  def which_way
    "this way or #{super_delegate(ThisWay)}"
  end
end

module ThatWay
  include Casting::SuperDelegate
  def which_way
    "#{ super_delegate } and that way!"
  end
end

describe Casting, 'modules using delegate_super' do
  it 'call the method from the next delegate with the same arguments' do
    client = TestPerson.new.extend(Casting::Client)
    client.delegate_missing_methods
    client.cast_as(AnyWay, ThisWay, ThatWay)

    assert_equal 'this way or any way and that way!', client.which_way
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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