Sha256: 7f8ab704e9e7de58aaa4a18651f59ed7f057c081ffa70af03e0604e4cc461c42

Contents?: true

Size: 678 Bytes

Versions: 12

Compression:

Stored size: 678 Bytes

Contents

$: << File.join(File.dirname(__FILE__), '..', 'sample')

require 'rubygems'
gem 'minitest'
require 'minitest/autorun'
require_relative '../../sample/callbacks/sample_callbacks'

class CallbacksTest < Minitest::Test
  def test_callbacks_sample_lambda
    cb = CallbackHolder.new
    cb.register_callback(lambda do |param|
      "Callback got: #{param}"
    end)

    assert_equal "Callback got: Hello", cb.fire_callback("Hello")
  end

  def hello_world(param)
    "Method got: #{param}"
  end

  def test_callbacks_sample_method
    cb = CallbackHolder.new
    cb.register_callback method(:hello_world)

    assert_equal "Method got: Hello", cb.fire_callback("Hello")
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rice-4.3.3 test/ruby/test_callbacks_sample.rb
rice-4.3.2 test/ruby/test_callbacks_sample.rb
rice-4.3.1 test/ruby/test_callbacks_sample.rb
rice-4.3.0 test/ruby/test_callbacks_sample.rb
rice-4.2.1 test/ruby/test_callbacks_sample.rb
rice-4.2.0 test/ruby/test_callbacks_sample.rb
rice-4.1.0 test/ruby/test_callbacks_sample.rb
rice-4.0.4 test/ruby/test_callbacks_sample.rb
rice-4.0.3 test/ruby/test_callbacks_sample.rb
rice-4.0.2 test/ruby/test_callbacks_sample.rb
rice-4.0.1 test/ruby/test_callbacks_sample.rb
rice-4.0.0 test/ruby/test_callbacks_sample.rb