Sha256: 40fd34f10a0695eca04e74d4eff74e40d64735d1b8654c77384fd796dea8ae67

Contents?: true

Size: 1017 Bytes

Versions: 11

Compression:

Stored size: 1017 Bytes

Contents

# -*- coding: utf-8 -*-
require 'spec_helper'

require 'tengine/event'

describe Tengine::Core::EventExceptionReportable do

  describe :to_reporter do
    context "Symbolで指定" do
      Tengine::Core::EventExceptionReportable::EVENT_EXCEPTION_REPORTERS.keys.each do |reporter_name|
        it reporter_name do
          Tengine::Core::EventExceptionReportable.to_reporter(reporter_name).should_not == nil
        end
      end
      it "存在しないreporter名" do
        expect{
          Tengine::Core::EventExceptionReportable.to_reporter(:unexist_reporter)
        }.to raise_error(NameError, "Unknown reporter: :unexist_reporter")
      end
    end

    it "Procを指定" do
      proc1 = Proc.new{  puts "foo" }
      Tengine::Core::EventExceptionReportable.to_reporter(proc1).should == proc1
    end

    it "不正なreporterを指定" do
      expect{
        Tengine::Core::EventExceptionReportable.to_reporter(100)
      }.to raise_error(ArgumentError, "Invalid reporter: 100")
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
tengine_core-0.5.39 spec/tengine/core/event_exception_reportable_spec.rb
tengine_core-0.5.38 spec/tengine/core/event_exception_reportable_spec.rb
tengine_core-0.5.37 spec/tengine/core/event_exception_reportable_spec.rb
tengine_core-0.5.36 spec/tengine/core/event_exception_reportable_spec.rb
tengine_core-0.5.35 spec/tengine/core/event_exception_reportable_spec.rb
tengine_core-0.5.34 spec/tengine/core/event_exception_reportable_spec.rb
tengine_core-0.5.33 spec/tengine/core/event_exception_reportable_spec.rb
tengine_core-0.5.32 spec/tengine/core/event_exception_reportable_spec.rb
tengine_core-0.5.31 spec/tengine/core/event_exception_reportable_spec.rb
tengine_core-0.5.30 spec/tengine/core/event_exception_reportable_spec.rb
tengine_core-0.5.28 spec/tengine/core/event_exception_reportable_spec.rb