Sha256: 9633291c9a3221fc93338760191b88138c424efd05ea394cfb8703ca1a646137

Contents?: true

Size: 1.32 KB

Versions: 6

Compression:

Stored size: 1.32 KB

Contents

require 'simplecov'

$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
$LOAD_PATH << File.join(File.dirname(__FILE__))

SimpleCov.start do
  add_filter 'spec/fixtures'
end

if ENV['CI']
  require 'codecov'
  SimpleCov.formatter = SimpleCov::Formatter::Codecov
end

require 'action_logic'

class CustomFormatter < ActionLogic::ActionBenchmark::DefaultFormatter
  def log_coordinator(benchmark_result, execution_context_name)
    benchmark_log.puts("The ActionCoordinator #{execution_context_name} took #{benchmark_result} to complete.")
  end

  def log_use_case(benchmark_result, execution_context_name)
    benchmark_log.puts("The ActionUseCase #{execution_context_name} took #{benchmark_result} to complete.")
  end

  def log_task(benchmark_result, execution_context_name)
    benchmark_log.puts("The ActionTask #{execution_context_name} took #{benchmark_result} to complete.")
  end
end

class CustomHandler
  def call
    yield
    "this is the custom handler"
  end
end

if ENV['BENCHMARK']
  ActionLogic.configure do |config|
    config.benchmark = true
    config.benchmark_log = File.open("benchmark.log", "w")
    config.benchmark_formatter = CustomFormatter
    config.benchmark_handler = CustomHandler.new
  end
end

RSpec.configure do |c|
  c.fail_fast = true
  c.color = true
  c.formatter = 'documentation'
  c.order = 'rand'
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
action_logic-0.3.3 spec/spec_helper.rb
action_logic-0.3.2 spec/spec_helper.rb
action_logic-0.3.1 spec/spec_helper.rb
action_logic-0.3.0 spec/spec_helper.rb
action_logic-0.2.8 spec/spec_helper.rb
action_logic-0.2.7 spec/spec_helper.rb