luna-rspec-formatters 3.7.3 → 3.7.4

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: 8fb76113909234eab9c589f965196b99e5f2a166
4
- data.tar.gz: ecface86ab80368ea161f5ca9f2531a1a3e0c068
3
+ metadata.gz: 7b06cc00b22f36b040080f5639de2cb4c10250a9
4
+ data.tar.gz: c58850048f4e7c74a37234ddf10fe4d4f0569c88
5
5
  SHA512:
6
- metadata.gz: 5f724a8d01c5766727e67fe782d2c3953582ebaa5ec94b6e51f3635bdd9a1eda85853461dfe8858ba8ea519c5f87099f4fee338e6d7e1c85507bbdaf3e263928
7
- data.tar.gz: 48b9197d63e0b680be8c3b9e5b57ecc482ac6f0008e00dcb286534ccc6ac03b342250e75525c2e5c45cd8d4775e0680ebd4223baa7dbb10bf1dc88e56f50d672
6
+ metadata.gz: 0d8199f1fcef313a35c9ccba35381ae073767a4bbc5e186cd85af6612989001c67af1f03af98b85c9b80692c6f369fc3a33e1ea990709abbaddc69139bb427f7
7
+ data.tar.gz: ddff27856640f609d14222b44562feccd4a304ed3d070e873b601d9221e24e79a727c5eb1d150ff8bf92c04893755fb803e9feed1ded8676aacf2c52500983af
data/Gemfile CHANGED
@@ -1,6 +1,8 @@
1
+ # ----------------------------------------------------------------------------
1
2
  # Frozen-string-literal: true
2
3
  # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
3
4
  # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
4
6
 
5
7
  source "https://rubygems.org"
6
8
  gemspec
@@ -1,6 +1,8 @@
1
+ # ----------------------------------------------------------------------------
1
2
  # Frozen-string-literal: true
2
3
  # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
3
4
  # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
4
6
 
5
7
  require "luna/rspec/formatters/emoji"
6
8
 
@@ -19,7 +21,10 @@ module Luna
19
21
  ]
20
22
  end
21
23
 
24
+ # --------------------------------------------------------------------
22
25
  # Passed.
26
+ # --------------------------------------------------------------------
27
+
23
28
  def example_passed(_)
24
29
  newline_or_addup
25
30
  output.print " ".freeze, success_color(
@@ -27,7 +32,10 @@ module Luna
27
32
  )
28
33
  end
29
34
 
35
+ # --------------------------------------------------------------------
30
36
  # Failed.
37
+ # --------------------------------------------------------------------
38
+
31
39
  def example_failed(_)
32
40
  newline_or_addup
33
41
  output.print " ".freeze, failure_color(
@@ -35,7 +43,10 @@ module Luna
35
43
  )
36
44
  end
37
45
 
46
+ # --------------------------------------------------------------------
38
47
  # Pending.
48
+ # --------------------------------------------------------------------
49
+
39
50
  def example_pending(_)
40
51
  newline_or_addup
41
52
  output.print " ".freeze, pending_color(
@@ -1,6 +1,8 @@
1
+ # ----------------------------------------------------------------------------
1
2
  # Frozen-string-literal: true
2
3
  # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
3
4
  # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
4
6
 
5
7
  require "luna/rspec/formatters/emoji"
6
8
 
@@ -21,7 +23,10 @@ module Luna
21
23
  ]
22
24
  end
23
25
 
26
+ # --------------------------------------------------------------------
24
27
  # Passed.
28
+ # --------------------------------------------------------------------
29
+
25
30
  def example_passed(_)
26
31
  newline_or_addup
27
32
  output.print " ".freeze, success_color(
@@ -29,7 +34,10 @@ module Luna
29
34
  )
30
35
  end
31
36
 
37
+ # --------------------------------------------------------------------
32
38
  # Failed.
39
+ # --------------------------------------------------------------------
40
+
33
41
  def example_failed(_)
34
42
  newline_or_addup
35
43
  output.print " ".freeze, failure_color(
@@ -37,7 +45,10 @@ module Luna
37
45
  )
38
46
  end
39
47
 
48
+ # --------------------------------------------------------------------
40
49
  # Pending.
50
+ # --------------------------------------------------------------------
51
+
41
52
  def example_pending(_)
42
53
  newline_or_addup
43
54
  output.print " ".freeze, pending_color(
@@ -1,6 +1,8 @@
1
+ # ----------------------------------------------------------------------------
1
2
  # Frozen-string-literal: true
2
3
  # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
3
4
  # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
4
6
 
5
7
  require "rspec/core/formatters/base_text_formatter"
6
8
  require "luna/rspec/formatters/profile"
@@ -18,28 +20,40 @@ module Luna
18
20
  end
19
21
  end
20
22
 
23
+ # --------------------------------------------------------------------
21
24
  # Note: If the terminal is too small we just let it go.
22
25
  # The total columns we allow.
26
+ # --------------------------------------------------------------------
27
+
23
28
  def allowed_cols
24
29
  @cols ||= begin
25
30
  (val = IO.console.winsize.last / 4) >= 24 ? val.floor : Float::INFINITY
26
31
  end
27
32
  end
28
33
 
34
+ # --------------------------------------------------------------------
29
35
  # Start.
36
+ # --------------------------------------------------------------------
37
+
30
38
  def start(_)
31
39
  @lines = 0
32
40
  output.puts
33
41
  end
34
42
 
43
+ # --------------------------------------------------------------------
35
44
  # End.
45
+ # --------------------------------------------------------------------
46
+
36
47
  def start_dump(_)
37
48
  output.puts
38
49
  end
39
50
 
40
- private
51
+ # --------------------------------------------------------------------
41
52
  # Determine if we should start a new line or keep on pushing out.
42
53
  # Note: if the terminal is too small we just let it go.
54
+ # --------------------------------------------------------------------
55
+
56
+ private
43
57
  def newline_or_addup
44
58
  return @lines+= 1 unless @lines == allowed_cols
45
59
  output.puts; @lines = 1
@@ -1,6 +1,8 @@
1
+ # ----------------------------------------------------------------------------
1
2
  # Frozen-string-literal: true
2
3
  # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
3
4
  # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
4
6
 
5
7
  require "rspec/core/formatters/base_text_formatter"
6
8
  require "luna/rspec/formatters/profile"
@@ -24,6 +26,8 @@ module Luna
24
26
  ]
25
27
  end
26
28
 
29
+ # --------------------------------------------------------------------
30
+
27
31
  [:success, :failure, :pending].each do |m|
28
32
  define_method "#{m}_color" do |v|
29
33
  defined?(super) ? super(v) : ::RSpec::Core::Formatters::ConsoleCodes.wrap(
@@ -32,17 +36,26 @@ module Luna
32
36
  end
33
37
  end
34
38
 
39
+ # --------------------------------------------------------------------
35
40
  # Start.
41
+ # --------------------------------------------------------------------
42
+
36
43
  def start(_)
37
44
  output.puts
38
45
  end
39
46
 
47
+ # --------------------------------------------------------------------
40
48
  # End.
49
+ # --------------------------------------------------------------------
50
+
41
51
  def start_dump(_)
42
52
  output.puts
43
53
  end
44
54
 
55
+ # --------------------------------------------------------------------
45
56
  # Passed.
57
+ # --------------------------------------------------------------------
58
+
46
59
  def example_passed(struct)
47
60
  output.print "\s"
48
61
  print_description(
@@ -50,7 +63,10 @@ module Luna
50
63
  )
51
64
  end
52
65
 
66
+ # --------------------------------------------------------------------
53
67
  # Failed.
68
+ # --------------------------------------------------------------------
69
+
54
70
  def example_failed(struct)
55
71
  output.print "\s"
56
72
  print_description(
@@ -58,7 +74,10 @@ module Luna
58
74
  )
59
75
  end
60
76
 
77
+ # --------------------------------------------------------------------
61
78
  # Pending.
79
+ # --------------------------------------------------------------------
80
+
62
81
  def example_pending(struct)
63
82
  output.print "\s"
64
83
  print_description(
@@ -66,13 +85,19 @@ module Luna
66
85
  )
67
86
  end
68
87
 
88
+ # --------------------------------------------------------------------
69
89
  # Pull.
90
+ # --------------------------------------------------------------------
91
+
70
92
  def get_example(struct)
71
93
  return struct unless struct.respond_to?(:example)
72
94
  struct.example
73
95
  end
74
96
 
97
+ # --------------------------------------------------------------------
75
98
  # Description.
99
+ # --------------------------------------------------------------------
100
+
76
101
  def print_description(example, type)
77
102
  output.print send(
78
103
  :"#{type}_color", " " + example.full_description + "\n"
@@ -1,6 +1,8 @@
1
+ # ----------------------------------------------------------------------------
1
2
  # Frozen-string-literal: true
2
3
  # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
3
4
  # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
4
6
 
5
7
  require "luna/rspec/formatters/emoji"
6
8
 
@@ -19,7 +21,10 @@ module Luna
19
21
  ]
20
22
  end
21
23
 
24
+ # --------------------------------------------------------------------
22
25
  # Passed.
26
+ # --------------------------------------------------------------------
27
+
23
28
  def example_passed(_)
24
29
  newline_or_addup
25
30
  output.print " ".freeze, success_color(
@@ -27,7 +32,10 @@ module Luna
27
32
  )
28
33
  end
29
34
 
35
+ # --------------------------------------------------------------------
30
36
  # Failed.
37
+ # --------------------------------------------------------------------
38
+
31
39
  def example_failed(_)
32
40
  newline_or_addup
33
41
  output.print " ".freeze, failure_color(
@@ -35,7 +43,10 @@ module Luna
35
43
  )
36
44
  end
37
45
 
46
+ # --------------------------------------------------------------------
38
47
  # Pending.
48
+ # --------------------------------------------------------------------
49
+
39
50
  def example_pending(_)
40
51
  newline_or_addup
41
52
  output.print " ".freeze, pending_color(
@@ -1,6 +1,8 @@
1
+ # ----------------------------------------------------------------------------
1
2
  # Frozen-string-literal: true
2
3
  # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
3
4
  # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
4
6
 
5
7
  module Luna
6
8
  module RSpec
@@ -11,12 +13,18 @@ module Luna
11
13
  GROUPS_HEADER = "\nTop %{size} slowest example groups:"
12
14
  EXAMPLES = " %{location} \u2910 %{seconds}"
13
15
 
16
+ # --------------------------------------------------------------------
14
17
  # Help.
18
+ # --------------------------------------------------------------------
19
+
15
20
  def helpers
16
- Object::RSpec::Core::Formatters::Helpers
21
+ ::RSpec::Core::Formatters::Helpers
17
22
  end
18
23
 
24
+ # --------------------------------------------------------------------
19
25
  # Profile.
26
+ # --------------------------------------------------------------------
27
+
20
28
  def dump_profile(profile)
21
29
  dump_profile_slowest_examples(profile)
22
30
  dump_profile_slowest_example_groups(
@@ -24,13 +32,17 @@ module Luna
24
32
  )
25
33
  end
26
34
 
27
- private
35
+ # --------------------------------------------------------------------
28
36
  # Slow examples.
37
+ # --------------------------------------------------------------------
38
+
39
+ private
29
40
  def dump_profile_slowest_examples(profile)
30
41
  examples_header(profile)
31
42
 
32
43
  profile.slowest_examples.each do |e|
33
- sec = helpers.format_seconds(e.execution_result.run_time) + " seconds"
44
+ sec = helpers.format_seconds(e.execution_result.run_time)
45
+ sec = sec + " seconds"
34
46
 
35
47
  @output.puts EXAMPLES % {
36
48
  :location => format_caller(e.location),
@@ -40,13 +52,17 @@ module Luna
40
52
  end
41
53
  end
42
54
 
43
- private
55
+ # --------------------------------------------------------------------
44
56
  # Slowest example groups.
57
+ # --------------------------------------------------------------------
58
+
59
+ private
45
60
  def dump_profile_slowest_example_groups(profile)
46
61
  groups_header(profile)
47
62
 
48
63
  profile.slowest_groups.each do |l, h|
49
- sec = helpers.format_seconds(h[:total_time]) + "seconds"
64
+ sec = helpers.format_seconds(h[:total_time])
65
+ sec = sec + " seconds"
50
66
 
51
67
  @output.puts color_blue(GROUPS % {
52
68
  :description => h[:description],
@@ -57,17 +73,22 @@ module Luna
57
73
  end
58
74
  end
59
75
 
60
- private
76
+ # --------------------------------------------------------------------
61
77
  # Headers group.
78
+ # --------------------------------------------------------------------
79
+
80
+ private
62
81
  def groups_header(profile)
63
82
  @output.puts GROUPS_HEADER % {
64
83
  :size => profile.slowest_groups.size
65
84
  }
66
85
  end
67
86
 
87
+ # --------------------------------------------------------------------
88
+ # Header example.
89
+ # --------------------------------------------------------------------
68
90
 
69
91
  private
70
- # Header example.
71
92
  def examples_header(profile)
72
93
  @output.puts EXAMPLES_HEADER % {
73
94
  :size => profile.slowest_examples.size,
@@ -76,6 +97,7 @@ module Luna
76
97
  }
77
98
  end
78
99
 
100
+ # --------------------------------------------------------------------
79
101
 
80
102
  private
81
103
  def color_blue(str)
@@ -84,6 +106,8 @@ module Luna
84
106
  )
85
107
  end
86
108
 
109
+ # --------------------------------------------------------------------
110
+
87
111
  private
88
112
  def strip_relative(path)
89
113
  path.gsub(
@@ -91,6 +115,8 @@ module Luna
91
115
  )
92
116
  end
93
117
 
118
+ # --------------------------------------------------------------------
119
+
94
120
  private
95
121
  def format_caller(caller_info)
96
122
  color_blue strip_relative(::RSpec.configuration.backtrace_formatter.backtrace_line(
@@ -19,7 +19,10 @@ module Luna
19
19
  ]
20
20
  end
21
21
 
22
+ # --------------------------------------------------------------------
22
23
  # Passed.
24
+ # --------------------------------------------------------------------
25
+
23
26
  def example_passed(_)
24
27
  newline_or_addup
25
28
  output.print " ".freeze, success_color(
@@ -27,7 +30,10 @@ module Luna
27
30
  )
28
31
  end
29
32
 
33
+ # --------------------------------------------------------------------
30
34
  # Failed.
35
+ # --------------------------------------------------------------------
36
+
31
37
  def example_failed(_)
32
38
  newline_or_addup
33
39
  output.print " ".freeze, failure_color(
@@ -35,7 +41,10 @@ module Luna
35
41
  )
36
42
  end
37
43
 
44
+ # --------------------------------------------------------------------
38
45
  # Pending.
46
+ # --------------------------------------------------------------------
47
+
39
48
  def example_pending(_)
40
49
  newline_or_addup
41
50
  output.print " ".freeze, pending_color(
@@ -1,11 +1,13 @@
1
+ # ----------------------------------------------------------------------------
1
2
  # Frozen-string-literal: true
2
3
  # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
3
4
  # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
4
6
 
5
7
  module Luna
6
8
  module Rspec
7
9
  module Formatters
8
- VERSION = "3.7.3"
10
+ VERSION = "3.7.4"
9
11
  end
10
12
  end
11
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: luna-rspec-formatters
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.3
4
+ version: 3.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordon Bedwell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-17 00:00:00.000000000 Z
11
+ date: 2016-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  version: '0'
69
69
  requirements: []
70
70
  rubyforge_project:
71
- rubygems_version: 2.5.1
71
+ rubygems_version: 2.6.2
72
72
  signing_key:
73
73
  specification_version: 4
74
74
  summary: RSpec formatters dedicated to Luna.