Sha256: d89a70f0a71b8c6afa796cc25c7556875b61339f6e93b36850e8191139839ba6

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 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.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.coordinator(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.coordinator(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

1 entries across 1 versions & 1 rubygems

Version Path
action_logic-0.2.4 spec/action_logic/action_benchmark/default_formatter_spec.rb