logion 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: be8e6f2bd8f3e0b454a4d84146da86c40603c4bf
4
- data.tar.gz: 1eda10f8e112c492920fc8536b8061af7a616033
3
+ metadata.gz: c2bed269dc4d75fde1720bc39c1db2c9291f1ebf
4
+ data.tar.gz: bcefa029204743fd3f01c38cde5dbe67bb527ff7
5
5
  SHA512:
6
- metadata.gz: 6875a5407fe0b56b8efb0381b70308de61f9186c57c18c4377c112d65ed29054149161ac8f0516de9cd89cbd0ef83884a8f7b3885f0b12ae57941f2dd67bdaf8
7
- data.tar.gz: 8ee522fb25fdf7d100c1f3e78d7a7168af87df3fb29e0ae40d2bdeb4d1312502cb54ae34b2e43c06dad3f2432289b1c9d2ad097b573c275721071ad21637ff59
6
+ metadata.gz: 4ee4a0c0e746e9f7f139bcd5ec64c04ff13e21b2e3740aa7606b3a36baec20d751c05db2886a0ee6a8d1d73498bb4de0b859352e57f2eee6f1bb87aedbe77db1
7
+ data.tar.gz: b18ed2fe60e9dcb5aa8994ae320577844921da0c38e7774735dfeb5a5e5c9f99c5624c8ba0d82e9ba86af0f4ff3222da8a9d8a5c03fcd64be77deb5618e40042
data/lib/logion.rb CHANGED
@@ -16,7 +16,8 @@ module Logion
16
16
  add_hooks: ->(logion) { fail "Rspec not present!" },
17
17
  logger: -> { fail 'No logger provided' },
18
18
  separator: lambda do |logion, example, action|
19
- logion.logger.debug colorize("#{ example.rerun_argument } #{ action }:", color: :white, background: :red)
19
+ path = example.respond_to?(:rerun_argument) ? example.rerun_argument : example.location
20
+ logion.logger.debug colorize("#{ path } #{ action }:", color: :white, background: :red)
20
21
  end,
21
22
  patcher_class: ::Logion::LoggerPatcher
22
23
  }
@@ -85,7 +86,8 @@ module Logion
85
86
  end
86
87
 
87
88
  def before(example)
88
- relative_path = example.rerun_argument.sub(/:(\d+)$/, '/\1.log')
89
+ path = example.respond_to?(:rerun_argument) ? example.rerun_argument : example.location
90
+ relative_path = path.sub(/:(\d+)$/, '/\1.log')
89
91
  location = log_base.join(relative_path)
90
92
  location = safe_location(location, relative_path)
91
93
 
@@ -1,16 +1,50 @@
1
1
  module Logion
2
2
  class Formatter < RSpec::Core::Formatters::BaseFormatter
3
- RSpec::Core::Formatters.register self, :example_failed, :dump_failures
3
+ if RSpec::Core::Formatters.respond_to?(:register)
4
+ RSpec::Core::Formatters.register self, :example_failed, :dump_failures
5
+ end
4
6
 
5
7
  def initialize(output)
8
+ super(output)
6
9
  @output = output
7
10
  end
8
11
 
9
- def example_failed(notification)
12
+ def example_failed(info)
13
+ if info.is_a?(RSpec::Core::Example)
14
+ super(info)
15
+ example_failed_example(info)
16
+ else
17
+ example_failed_notification(info)
18
+ end
19
+ end
20
+
21
+ def dump_failures(notification = nil)
22
+ if notification
23
+ dump_failures_notification(notification)
24
+ else
25
+ dump_failures_example
26
+ end
27
+ end
28
+
29
+ # rspec 2.99
30
+ def example_failed_example(example)
31
+ show_failure_debug_info(example)
32
+ end
33
+
34
+ def dump_failures_example
35
+ return if failed_examples.empty?
36
+ failed_examples.each do |example|
37
+ next unless example.exception
38
+ show_failure_debug_info(example)
39
+ end
40
+ end
41
+
42
+ # rspec 3.x
43
+ def example_failed_notification(notification)
10
44
  show_failure_debug_info(notification.example)
11
45
  end
12
46
 
13
- def dump_failures(notification)
47
+ def dump_failures_notification(notification)
14
48
  return if notification.failure_notifications.empty?
15
49
  notification.examples.each do |example|
16
50
  next unless example.exception
@@ -21,8 +55,10 @@ module Logion
21
55
  private
22
56
 
23
57
  def show_failure_debug_info(example)
58
+ path = example.respond_to?(:rerun_argument) ? example.rerun_argument : example.location
59
+
24
60
  @output.puts(::Logion::Logion.colorize('----------------------------', color: :yellow))
25
- @output.puts(::Logion::Logion.colorize(example.rerun_argument, color: :yellow, background: :blue))
61
+ @output.puts(::Logion::Logion.colorize(path, color: :yellow, background: :blue))
26
62
  @output.puts(::Logion::Logion.colorize(example.metadata[:log_location].to_s, color: :white, background: :blue))
27
63
  if example.metadata[:screenshot].is_a?(Hash)
28
64
  example.metadata[:screenshot].each do |type, path|
@@ -1,3 +1,3 @@
1
1
  module Logion
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valery Guskov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-03 00:00:00.000000000 Z
11
+ date: 2016-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rspec
15
- version_requirements: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
14
  requirement: !ruby/object:Gem::Requirement
21
15
  requirements:
22
16
  - - '>='
23
17
  - !ruby/object:Gem::Version
24
18
  version: '0'
19
+ name: rspec
25
20
  prerelease: false
26
21
  type: :runtime
27
- - !ruby/object:Gem::Dependency
28
- name: colorize
29
22
  version_requirements: !ruby/object:Gem::Requirement
30
23
  requirements:
31
- - - ~>
24
+ - - '>='
32
25
  - !ruby/object:Gem::Version
33
- version: 0.7.7
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
34
28
  requirement: !ruby/object:Gem::Requirement
35
29
  requirements:
36
30
  - - ~>
37
31
  - !ruby/object:Gem::Version
38
32
  version: 0.7.7
33
+ name: colorize
39
34
  prerelease: false
40
35
  type: :runtime
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 0.7.7
41
41
  description: A hacky gem to output per-example logs
42
42
  email:
43
43
  - valerijs.gusjkovs@gmail.com