luna-rspec-formatters 3.7.2 → 3.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b20e6cd28ec986ffb213472c0931adb78389190
4
- data.tar.gz: 8034b8ce79e7807c463cf5b45e5c3ba1c77e7360
3
+ metadata.gz: 8fb76113909234eab9c589f965196b99e5f2a166
4
+ data.tar.gz: ecface86ab80368ea161f5ca9f2531a1a3e0c068
5
5
  SHA512:
6
- metadata.gz: 5b9d5f0755509b222b7706de96bcdc2c3e792180318dc7ee06e8468a1c479705f9a85ad7e1ca51574e4d0f3c43a329a59767f63ec33c6c583e9352a3a36525fe
7
- data.tar.gz: 5d25ab6e05656cc15c6bfe80cd9ba4d87a2dc2c58703058b403641da6a944ba5f2bb17cf31ca9f52ddc9516d90fbe12f6782f9d7b7ad0cc73c26c8ecb98398d4
6
+ metadata.gz: 5f724a8d01c5766727e67fe782d2c3953582ebaa5ec94b6e51f3635bdd9a1eda85853461dfe8858ba8ea519c5f87099f4fee338e6d7e1c85507bbdaf3e263928
7
+ data.tar.gz: 48b9197d63e0b680be8c3b9e5b57ecc482ac6f0008e00dcb286534ccc6ac03b342250e75525c2e5c45cd8d4775e0680ebd4223baa7dbb10bf1dc88e56f50d672
data/Gemfile CHANGED
@@ -1,8 +1,6 @@
1
- # ----------------------------------------------------------------------------
2
1
  # Frozen-string-literal: true
3
2
  # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
4
3
  # Encoding: utf-8
5
- # ----------------------------------------------------------------------------
6
4
 
7
5
  source "https://rubygems.org"
8
6
  gemspec
@@ -1,8 +1,6 @@
1
- # ----------------------------------------------------------------------------
2
1
  # Frozen-string-literal: true
3
2
  # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
4
3
  # Encoding: utf-8
5
- # ----------------------------------------------------------------------------
6
4
 
7
5
  require "luna/rspec/formatters/emoji"
8
6
 
@@ -21,8 +19,7 @@ module Luna
21
19
  ]
22
20
  end
23
21
 
24
- # --------------------------------------------------------------------
25
-
22
+ # Passed.
26
23
  def example_passed(_)
27
24
  newline_or_addup
28
25
  output.print " ".freeze, success_color(
@@ -30,8 +27,7 @@ module Luna
30
27
  )
31
28
  end
32
29
 
33
- # --------------------------------------------------------------------
34
-
30
+ # Failed.
35
31
  def example_failed(_)
36
32
  newline_or_addup
37
33
  output.print " ".freeze, failure_color(
@@ -39,8 +35,7 @@ module Luna
39
35
  )
40
36
  end
41
37
 
42
- # --------------------------------------------------------------------
43
-
38
+ # Pending.
44
39
  def example_pending(_)
45
40
  newline_or_addup
46
41
  output.print " ".freeze, pending_color(
@@ -1,8 +1,6 @@
1
- # ----------------------------------------------------------------------------
2
1
  # Frozen-string-literal: true
3
2
  # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
4
3
  # Encoding: utf-8
5
- # ----------------------------------------------------------------------------
6
4
 
7
5
  require "luna/rspec/formatters/emoji"
8
6
 
@@ -23,8 +21,7 @@ module Luna
23
21
  ]
24
22
  end
25
23
 
26
- # --------------------------------------------------------------------
27
-
24
+ # Passed.
28
25
  def example_passed(_)
29
26
  newline_or_addup
30
27
  output.print " ".freeze, success_color(
@@ -32,8 +29,7 @@ module Luna
32
29
  )
33
30
  end
34
31
 
35
- # --------------------------------------------------------------------
36
-
32
+ # Failed.
37
33
  def example_failed(_)
38
34
  newline_or_addup
39
35
  output.print " ".freeze, failure_color(
@@ -41,8 +37,7 @@ module Luna
41
37
  )
42
38
  end
43
39
 
44
- # --------------------------------------------------------------------
45
-
40
+ # Pending.
46
41
  def example_pending(_)
47
42
  newline_or_addup
48
43
  output.print " ".freeze, pending_color(
@@ -1,8 +1,6 @@
1
- # ----------------------------------------------------------------------------
2
1
  # Frozen-string-literal: true
3
2
  # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
4
3
  # Encoding: utf-8
5
- # ----------------------------------------------------------------------------
6
4
 
7
5
  require "rspec/core/formatters/base_text_formatter"
8
6
  require "luna/rspec/formatters/profile"
@@ -20,30 +18,28 @@ module Luna
20
18
  end
21
19
  end
22
20
 
23
- # --------------------------------------------------------------------
24
-
21
+ # Note: If the terminal is too small we just let it go.
22
+ # The total columns we allow.
25
23
  def allowed_cols
26
24
  @cols ||= begin
27
25
  (val = IO.console.winsize.last / 4) >= 24 ? val.floor : Float::INFINITY
28
26
  end
29
27
  end
30
28
 
31
- # --------------------------------------------------------------------
32
-
29
+ # Start.
33
30
  def start(_)
34
31
  @lines = 0
35
32
  output.puts
36
33
  end
37
34
 
38
- # --------------------------------------------------------------------
39
-
35
+ # End.
40
36
  def start_dump(_)
41
37
  output.puts
42
38
  end
43
39
 
44
- # --------------------------------------------------------------------
45
-
46
40
  private
41
+ # Determine if we should start a new line or keep on pushing out.
42
+ # Note: if the terminal is too small we just let it go.
47
43
  def newline_or_addup
48
44
  return @lines+= 1 unless @lines == allowed_cols
49
45
  output.puts; @lines = 1
@@ -1,8 +1,6 @@
1
- # ----------------------------------------------------------------------------
2
1
  # Frozen-string-literal: true
3
2
  # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
4
3
  # Encoding: utf-8
5
- # ----------------------------------------------------------------------------
6
4
 
7
5
  require "rspec/core/formatters/base_text_formatter"
8
6
  require "luna/rspec/formatters/profile"
@@ -26,8 +24,6 @@ module Luna
26
24
  ]
27
25
  end
28
26
 
29
- # --------------------------------------------------------------------
30
-
31
27
  [:success, :failure, :pending].each do |m|
32
28
  define_method "#{m}_color" do |v|
33
29
  defined?(super) ? super(v) : ::RSpec::Core::Formatters::ConsoleCodes.wrap(
@@ -36,20 +32,17 @@ module Luna
36
32
  end
37
33
  end
38
34
 
39
- # --------------------------------------------------------------------
40
-
35
+ # Start.
41
36
  def start(_)
42
37
  output.puts
43
38
  end
44
39
 
45
- # --------------------------------------------------------------------
46
-
40
+ # End.
47
41
  def start_dump(_)
48
42
  output.puts
49
43
  end
50
44
 
51
- # --------------------------------------------------------------------
52
-
45
+ # Passed.
53
46
  def example_passed(struct)
54
47
  output.print "\s"
55
48
  print_description(
@@ -57,8 +50,7 @@ module Luna
57
50
  )
58
51
  end
59
52
 
60
- # --------------------------------------------------------------------
61
-
53
+ # Failed.
62
54
  def example_failed(struct)
63
55
  output.print "\s"
64
56
  print_description(
@@ -66,8 +58,7 @@ module Luna
66
58
  )
67
59
  end
68
60
 
69
- # --------------------------------------------------------------------
70
-
61
+ # Pending.
71
62
  def example_pending(struct)
72
63
  output.print "\s"
73
64
  print_description(
@@ -75,15 +66,13 @@ module Luna
75
66
  )
76
67
  end
77
68
 
78
- # --------------------------------------------------------------------
79
-
69
+ # Pull.
80
70
  def get_example(struct)
81
71
  return struct unless struct.respond_to?(:example)
82
72
  struct.example
83
73
  end
84
74
 
85
- # --------------------------------------------------------------------
86
-
75
+ # Description.
87
76
  def print_description(example, type)
88
77
  output.print send(
89
78
  :"#{type}_color", " " + example.full_description + "\n"
@@ -1,8 +1,6 @@
1
- # ----------------------------------------------------------------------------
2
1
  # Frozen-string-literal: true
3
2
  # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
4
3
  # Encoding: utf-8
5
- # ----------------------------------------------------------------------------
6
4
 
7
5
  require "luna/rspec/formatters/emoji"
8
6
 
@@ -21,8 +19,7 @@ module Luna
21
19
  ]
22
20
  end
23
21
 
24
- # --------------------------------------------------------------------
25
-
22
+ # Passed.
26
23
  def example_passed(_)
27
24
  newline_or_addup
28
25
  output.print " ".freeze, success_color(
@@ -30,8 +27,7 @@ module Luna
30
27
  )
31
28
  end
32
29
 
33
- # --------------------------------------------------------------------
34
-
30
+ # Failed.
35
31
  def example_failed(_)
36
32
  newline_or_addup
37
33
  output.print " ".freeze, failure_color(
@@ -39,8 +35,7 @@ module Luna
39
35
  )
40
36
  end
41
37
 
42
- # --------------------------------------------------------------------
43
-
38
+ # Pending.
44
39
  def example_pending(_)
45
40
  newline_or_addup
46
41
  output.print " ".freeze, pending_color(
@@ -1,8 +1,6 @@
1
- # ----------------------------------------------------------------------------
2
1
  # Frozen-string-literal: true
3
2
  # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
4
3
  # Encoding: utf-8
5
- # ----------------------------------------------------------------------------
6
4
 
7
5
  module Luna
8
6
  module RSpec
@@ -13,14 +11,12 @@ module Luna
13
11
  GROUPS_HEADER = "\nTop %{size} slowest example groups:"
14
12
  EXAMPLES = " %{location} \u2910 %{seconds}"
15
13
 
16
- # --------------------------------------------------------------------
17
-
14
+ # Help.
18
15
  def helpers
19
16
  Object::RSpec::Core::Formatters::Helpers
20
17
  end
21
18
 
22
- # --------------------------------------------------------------------
23
-
19
+ # Profile.
24
20
  def dump_profile(profile)
25
21
  dump_profile_slowest_examples(profile)
26
22
  dump_profile_slowest_example_groups(
@@ -28,9 +24,8 @@ module Luna
28
24
  )
29
25
  end
30
26
 
31
- # --------------------------------------------------------------------
32
-
33
27
  private
28
+ # Slow examples.
34
29
  def dump_profile_slowest_examples(profile)
35
30
  examples_header(profile)
36
31
 
@@ -45,8 +40,8 @@ module Luna
45
40
  end
46
41
  end
47
42
 
48
- # --------------------------------------------------------------------
49
-
43
+ private
44
+ # Slowest example groups.
50
45
  def dump_profile_slowest_example_groups(profile)
51
46
  groups_header(profile)
52
47
 
@@ -62,16 +57,17 @@ module Luna
62
57
  end
63
58
  end
64
59
 
65
- # --------------------------------------------------------------------
66
-
60
+ private
61
+ # Headers group.
67
62
  def groups_header(profile)
68
63
  @output.puts GROUPS_HEADER % {
69
64
  :size => profile.slowest_groups.size
70
65
  }
71
66
  end
72
67
 
73
- # --------------------------------------------------------------------
74
68
 
69
+ private
70
+ # Header example.
75
71
  def examples_header(profile)
76
72
  @output.puts EXAMPLES_HEADER % {
77
73
  :size => profile.slowest_examples.size,
@@ -80,24 +76,22 @@ module Luna
80
76
  }
81
77
  end
82
78
 
83
- # --------------------------------------------------------------------
84
79
 
80
+ private
85
81
  def color_blue(str)
86
82
  Object::RSpec::Core::Formatters::ConsoleCodes.wrap(
87
83
  str, :cyan
88
84
  )
89
85
  end
90
86
 
91
- # --------------------------------------------------------------------
92
-
87
+ private
93
88
  def strip_relative(path)
94
89
  path.gsub(
95
90
  /\A\.\//, ""
96
91
  )
97
92
  end
98
93
 
99
- # --------------------------------------------------------------------
100
-
94
+ private
101
95
  def format_caller(caller_info)
102
96
  color_blue strip_relative(::RSpec.configuration.backtrace_formatter.backtrace_line(
103
97
  caller_info.to_s.split(':in `block').first
@@ -1,8 +1,6 @@
1
- # ----------------------------------------------------------------------------
2
1
  # Frozen-string-literal: true
3
2
  # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
4
3
  # Encoding: utf-8
5
- # ----------------------------------------------------------------------------
6
4
 
7
5
  require "luna/rspec/formatters/emoji"
8
6
 
@@ -21,8 +19,7 @@ module Luna
21
19
  ]
22
20
  end
23
21
 
24
- # --------------------------------------------------------------------
25
-
22
+ # Passed.
26
23
  def example_passed(_)
27
24
  newline_or_addup
28
25
  output.print " ".freeze, success_color(
@@ -30,8 +27,7 @@ module Luna
30
27
  )
31
28
  end
32
29
 
33
- # --------------------------------------------------------------------
34
-
30
+ # Failed.
35
31
  def example_failed(_)
36
32
  newline_or_addup
37
33
  output.print " ".freeze, failure_color(
@@ -39,8 +35,7 @@ module Luna
39
35
  )
40
36
  end
41
37
 
42
- # --------------------------------------------------------------------
43
-
38
+ # Pending.
44
39
  def example_pending(_)
45
40
  newline_or_addup
46
41
  output.print " ".freeze, pending_color(
@@ -1,13 +1,11 @@
1
- # ----------------------------------------------------------------------------
2
1
  # Frozen-string-literal: true
3
2
  # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
4
3
  # Encoding: utf-8
5
- # ----------------------------------------------------------------------------
6
4
 
7
5
  module Luna
8
6
  module Rspec
9
7
  module Formatters
10
- VERSION = "3.7.2"
8
+ VERSION = "3.7.3"
11
9
  end
12
10
  end
13
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: luna-rspec-formatters
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.2
4
+ version: 3.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordon Bedwell