blinka-reporter 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/blinka_minitest.rb +18 -27
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76add87e3b4c07e52d38ace7ea5c8359b0eb2dc636165ffdf753fb3d475ed119
4
- data.tar.gz: 5322abc35807213e72c59876ab0b33d5aaa8312bc8d56daf4203d34737666f5d
3
+ metadata.gz: d84bd0f016744a88e06403d6f01f730004bf3cfb31b36394174f1335c12cd103
4
+ data.tar.gz: 3ab3b1744b8be12c29227e080ed0a39e6039ff63e0e883063d21b5c80a212290
5
5
  SHA512:
6
- metadata.gz: bff827a035306476db6c83740fa95fb6a620c9475e012ef7d48b9d6feac766fc47f31e91c63bb9ecca57bddb2064c3951b97393d5206d4937b44e62078518a5d
7
- data.tar.gz: 6e1432283c7f061f44448b67cd4af16be906b4baf38cda9947ea6b9d4af1d4e4a1ebaf96b7231685afbfffc9d10ee6042103921f8c01dcf04b0b8f1db3a256b2
6
+ metadata.gz: cd1ee46a25fb0c799ae89054c6b835f11aea3883420320d5809160b2315ad1eb93640aea7588b1509fb744c79dc7fb6a5a35b3b47ba493cdc81b2bcb65ee671a
7
+ data.tar.gz: 97c433c7f79f60e8441376f47fcc9d937e2d1c02db93d67793655aed288d0367eea13d02fa1a7833ff6a299611e3c971f121d8b5169cc7d0f2dcf4b93e0cde73
@@ -1,5 +1,4 @@
1
1
  class BlinkaMinitest
2
- attr_reader(:test_result)
3
2
  def initialize(test_result)
4
3
  @test_result = test_result
5
4
  end
@@ -8,14 +7,19 @@ class BlinkaMinitest
8
7
  @path ||= source_location.first.gsub(Dir.getwd, '').delete_prefix('/')
9
8
  end
10
9
 
10
+ def line
11
+ @line ||= source_location.last
12
+ end
13
+
11
14
  # Handle broken API in Minitest between 5.10 and 5.11
12
15
  # https://github.com/minitest-reporters/minitest-reporters/blob/e9092460b5a5cf5ca9eb375428217cbb2a7f6dbb/lib/minitest/reporters/default_reporter.rb#L159
13
16
  def source_location
14
- if test_result.respond_to?(:klass)
15
- test_result.source_location
16
- else
17
- test_result.method(test_result.name).source_location
18
- end
17
+ @source_location ||=
18
+ if @test_result.respond_to?(:klass)
19
+ @test_result.source_location
20
+ else
21
+ @test_result.method(@test_result.name).source_location
22
+ end
19
23
  end
20
24
 
21
25
  def kind
@@ -24,47 +28,34 @@ class BlinkaMinitest
24
28
  end
25
29
 
26
30
  def message
27
- failure = test_result.failure
31
+ failure = @test_result.failure
28
32
  return unless failure
29
33
  "#{failure.error.class}: #{failure.error.message}"
30
34
  end
31
35
 
32
36
  def backtrace
33
- return unless test_result.failure
34
- Minitest.filter_backtrace(test_result.failure.backtrace)
37
+ return unless @test_result.failure
38
+ Minitest.filter_backtrace(@test_result.failure.backtrace)
35
39
  end
36
40
 
37
41
  def result
38
- if test_result.error?
42
+ if @test_result.error?
39
43
  :error
40
- elsif test_result.skipped?
44
+ elsif @test_result.skipped?
41
45
  :skip
42
- elsif test_result.failure
46
+ elsif @test_result.failure
43
47
  :failed
44
48
  else
45
49
  :pass
46
50
  end
47
51
  end
48
52
 
49
- def line
50
- current_backtrace = backtrace
51
- return if current_backtrace.nil?
52
-
53
- row =
54
- current_backtrace
55
- .map { |row| row.split(':')[0..1] }
56
- .detect { |row| row[0] == path }
57
-
58
- return if row.nil?
59
- row[1].to_i
60
- end
61
-
62
53
  def time
63
- test_result.time
54
+ @test_result.time
64
55
  end
65
56
 
66
57
  def name
67
- test_result.name
58
+ @test_result.name
68
59
  end
69
60
 
70
61
  def image
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blinka-reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Wessman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-13 00:00:00.000000000 Z
11
+ date: 2021-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty