Sha256: 192a30b10976e8efbaa51372ede7169ff724c7f47ab10bdaf57320b83d8bf535

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

require File.expand_path(__FILE__ + '/../../../../test_helper')

unit_tests do

  test "fire a probe with no data and no block" do
    aClass = Class.new do
      include XRay::DTrace::Tracer
    end

    aClass.new.fire "a name"
  end

  test "fire a probe with data and no block" do
    aClass = Class.new do
      include XRay::DTrace::Tracer
    end

    aClass.new.fire "a name", "some data"
  end

  test "Can check whether ruby-probe is enabled" do
    aClass = Class.new do
      include XRay::DTrace::Tracer
    end

    assert [true, false].include?(aClass.new.enabled?)
  end

  test "fire a probe with block and no data" do
    anObject = Class.new do
      include XRay::DTrace::Tracer
    end.new
  
    result = anObject.firing("a-name") do
      :expected_result
    end
  
    assert_equal :expected_result, result
  end
  
  test "fire a probe with block and data" do
    anObject = Class.new do
      include XRay::DTrace::Tracer
    end.new
  
    result = anObject.firing("a-name", "some data") do
      :expected_result
    end
  
    assert_equal :expected_result, result
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
XRay-1.0 test/unit/xray/dtrace/tracer_test.rb
XRay-1.0.1 test/unit/xray/dtrace/tracer_test.rb
XRay-1.0.3 test/unit/xray/dtrace/tracer_test.rb