Sha256: d9dcddd43b489410af557103ff8c974128b69d0b7c75a704c08128b3b720daad

Contents?: true

Size: 1.2 KB

Versions: 8

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

module ActionLogic::ActionBenchmark
  describe DefaultFormatter do

    let(:benchmark_log) { StringIO.new }
    let(:benchmark_result) { double(:benchmark_result, utime: 0.00003, stime: 0.00002, total: 0.00001, real: 0.00030) }

    subject { described_class.new(benchmark_log: benchmark_log) }

    it "writes the benchmark result to the log for an ActionCoordinator" do
      subject.log_coordinator(benchmark_result, "CoordinatorContext")
      expect(benchmark_log.string).to\
        eq "context:CoordinatorContext user_time:0.000030 system_time:0.000020 total_time:0.000010 real_time:0.000300\n"
    end

    it "writes the benchmark result to the log for an ActionUseCase" do
      subject.log_use_case(benchmark_result, "UseCaseContext")
      expect(benchmark_log.string).to\
        eq "context:UseCaseContext user_time:0.000030 system_time:0.000020 total_time:0.000010 real_time:0.000300\n"
    end

    it "writes the benchmark result to the log for an ActionTask" do
      subject.log_task(benchmark_result, "TaskContext")
      expect(benchmark_log.string).to\
        eq "context:TaskContext user_time:0.000030 system_time:0.000020 total_time:0.000010 real_time:0.000300\n"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
action_logic-0.3.3 spec/action_logic/action_benchmark/default_formatter_spec.rb
action_logic-0.3.2 spec/action_logic/action_benchmark/default_formatter_spec.rb
action_logic-0.3.1 spec/action_logic/action_benchmark/default_formatter_spec.rb
action_logic-0.3.0 spec/action_logic/action_benchmark/default_formatter_spec.rb
action_logic-0.2.8 spec/action_logic/action_benchmark/default_formatter_spec.rb
action_logic-0.2.7 spec/action_logic/action_benchmark/default_formatter_spec.rb
action_logic-0.2.6 spec/action_logic/action_benchmark/default_formatter_spec.rb
action_logic-0.2.5 spec/action_logic/action_benchmark/default_formatter_spec.rb