File: log_split.rb

package info (click to toggle)
ruby-rspec-logsplit 0.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 136 kB
  • sloc: ruby: 133; makefile: 7
file content (38 lines) | stat: -rw-r--r-- 839 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require 'date'
require 'logger'
require 'pathname'

require 'rspec/log_split/handler'
require 'rspec/log_split/config'

module RSpec
  module LogSplit
    class << self

      def apply
        RSpec.configure do |config|
          config.add_setting :log_split_module
          config.add_setting :log_split_dir
          config.add_setting :log_split

          config.before(:suite) do
            RSpec.configuration.log_split= Config.new(
              RSpec.configuration.log_split_module,
              RSpec.configuration.log_split_dir,
            )
          end

          config.around(:each) do |example|
            RSpec.configuration.log_split.run(example)
          end

          config.after(:suite) do
            Handler.list_logs if $DEBUG
          end
        end
      end
    end
  end
end

RSpec::LogSplit.apply