luna-rspec-formatters 3.4.0 → 3.5.0

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: 2736dd9bc87741064d0ff98dfbbf2780379a5ee3
4
- data.tar.gz: dac892532d6d808967e7f7468176d87136fa41ca
3
+ metadata.gz: ad6f5b77993d5cba51446d7793e6626b24cdb28e
4
+ data.tar.gz: ff2362897e52261f6bf921ddbf865050c5d1f01a
5
5
  SHA512:
6
- metadata.gz: 5b02dfe478d03cf3b8c6960cdbfa2e589cdd9d3b5a40e914002bf8eca82bf847f7ce6a8c19857a77ad5caceb2cc11383d7353badbeb96968de757147ce7e69b8
7
- data.tar.gz: 4e0e36bd0d0edc864f5f3ba789c082a7d3287b29428c3880eed1d120fc0f2569b903d5f930df2196ec0cddbe1d80b166be040b7e8f9104a5304e5ecf7a1ed47e
6
+ metadata.gz: 7b564e2db5c45a7d254538eaf7c4c55b3aa175b542a6726b0fa84b0f40def80ae5ad5f35842c68ce476fb23b03d829339c533a2873dc9c8feb3e1cbfb38f987e
7
+ data.tar.gz: cb6a7a05d7143f88fad3073d3da7aa162878487df5b9844c82f6ba78d3d5ec9d46a08b72e15d5532fa5deca97d213a3ebb36a782b4d314ec340ac79eb5820410
data/Gemfile CHANGED
@@ -1,6 +1,14 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
1
7
  source "https://rubygems.org"
2
8
  gemspec
3
9
 
10
+ gem "rake"
4
11
  group :development do
5
- gem "rake"
12
+ gem "rubocop", :github => "bbatsov/rubocop", :require => false
13
+ gem "pry", :require => false
6
14
  end
data/LICENSE CHANGED
@@ -1,12 +1,19 @@
1
- Copyright 2013-2015 Jordon Bedwell.
2
- Apache License.
1
+ Copyright (c) 2015-2016 Jordon Bedwell
3
2
 
4
- Licensed under the Apache License, Version 2.0 (the "License"); you may
5
- not use this file except in compliance with the License. You may obtain
6
- a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the "Software"),
5
+ to deal in the Software without restriction, including without limitation
6
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
7
+ and/or sell copies of the Software, and to permit persons to whom the
8
+ Software is furnished to do so, subject to the following conditions:
7
9
 
8
- Unless required by applicable law or agreed to in writing, software
9
- distributed under the License is distributed on an "AS IS" BASIS,
10
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
11
- implied. See the License for the specific language governing
12
- permissions and limitations under the License.
10
+ The above copyright notice and this permission notice shall be included
11
+ in all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
18
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
19
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ## RSpec Formatters Luna
1
+ ## Luna RSpec Formatters
2
2
 
3
3
  ```ruby
4
4
  gem "luna-rspec-formatters"
@@ -1,11 +1,17 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
1
7
  require "luna/rspec/formatters/emoji"
2
8
 
3
9
  module Luna
4
10
  module RSpec
5
11
  module Formatters
6
12
  class Smilies < Emoji
7
- if Gem::Version.new(::RSpec::Version::STRING) >= Gem::Version.new("3.0")
8
- ::RSpec::Core::Formatters.register self, *[
13
+ if Gem::Version.new(Object::RSpec::Version::STRING) >= Gem::Version.new("3.0")
14
+ then Object::RSpec::Core::Formatters.register self, *[
9
15
  :start,
10
16
  :start_dump,
11
17
  :example_passed,
@@ -15,21 +21,27 @@ module Luna
15
21
  ]
16
22
  end
17
23
 
18
- def example_passed(e)
24
+ # --------------------------------------------------------------------
25
+
26
+ def example_passed(_)
19
27
  newline_or_addup
20
28
  output.print " ".freeze, success_color(
21
29
  "\u1F63B"
22
30
  )
23
31
  end
24
32
 
25
- def example_failed(e)
33
+ # --------------------------------------------------------------------
34
+
35
+ def example_failed(_)
26
36
  newline_or_addup
27
37
  output.print " ".freeze, failure_color(
28
38
  "\u1F63E"
29
39
  )
30
40
  end
31
41
 
32
- def example_pending(e)
42
+ # --------------------------------------------------------------------
43
+
44
+ def example_pending(_)
33
45
  newline_or_addup
34
46
  output.print " ".freeze, pending_color(
35
47
  "\u1F63F"
@@ -1,3 +1,9 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
1
7
  require "luna/rspec/formatters/emoji"
2
8
 
3
9
  module Luna
@@ -6,8 +12,8 @@ module Luna
6
12
  class Checks < Emoji
7
13
  include Profile
8
14
 
9
- if Gem::Version.new(::RSpec::Version::STRING) >= Gem::Version.new("3.0")
10
- ::RSpec::Core::Formatters.register self, *[
15
+ if Gem::Version.new(Object::RSpec::Version::STRING) >= Gem::Version.new("3.0")
16
+ then Object::RSpec::Core::Formatters.register self, *[
11
17
  :start,
12
18
  :start_dump,
13
19
  :example_passed,
@@ -17,21 +23,27 @@ module Luna
17
23
  ]
18
24
  end
19
25
 
20
- def example_passed(e)
26
+ # --------------------------------------------------------------------
27
+
28
+ def example_passed(_)
21
29
  newline_or_addup
22
30
  output.print " ".freeze, success_color(
23
31
  "\u2714"
24
32
  )
25
33
  end
26
34
 
27
- def example_failed(e)
35
+ # --------------------------------------------------------------------
36
+
37
+ def example_failed(_)
28
38
  newline_or_addup
29
39
  output.print " ".freeze, failure_color(
30
40
  "\u2718"
31
41
  )
32
42
  end
33
43
 
34
- def example_pending(e)
44
+ # --------------------------------------------------------------------
45
+
46
+ def example_pending(_)
35
47
  newline_or_addup
36
48
  output.print " ".freeze, pending_color(
37
49
  "\u203D"
@@ -1,3 +1,9 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
1
7
  require "rspec/core/formatters/base_text_formatter"
2
8
  require "luna/rspec/formatters/profile"
3
9
  require "rspec/version"
@@ -10,27 +16,37 @@ module Luna
10
16
 
11
17
  [:success, :failure, :pending].each do |m|
12
18
  define_method "#{m}_color" do |v|
13
- defined?(super) ? super(v) : \
14
- ::RSpec::Core::Formatters::ConsoleCodes.wrap(v, m)
19
+ defined?(super) ? super(v) : Object::RSpec::Core::Formatters::ConsoleCodes.wrap(v, m)
15
20
  end
16
21
  end
17
22
 
23
+ # --------------------------------------------------------------------
24
+
18
25
  def allowed_cols
19
- @cols ||= (`tput cols 2>/dev/null || 80`.to_i / 1.6).floor
26
+ @cols ||= begin
27
+ (`tput cols 2>/dev/null || 80`.to_i / 1.6).floor
28
+ end
20
29
  end
21
30
 
22
- def start(*args)
31
+ # --------------------------------------------------------------------
32
+
33
+ def start(_)
23
34
  @lines = 0
24
35
  output.puts
25
36
  end
26
37
 
27
- def start_dump(*args)
38
+ # --------------------------------------------------------------------
39
+
40
+ def start_dump(_)
28
41
  output.puts
29
42
  end
30
43
 
44
+ # --------------------------------------------------------------------
45
+
31
46
  private
32
47
  def newline_or_addup
33
- @lines == allowed_cols ? (output.puts; @lines = 1) : @lines+=1
48
+ return @lines+= 1 unless @lines == allowed_cols
49
+ output.puts; @lines = 1
34
50
  end
35
51
  end
36
52
  end
@@ -1,3 +1,9 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
1
7
  require "rspec/core/formatters/base_text_formatter"
2
8
  require "luna/rspec/formatters/profile"
3
9
  require "rspec/version"
@@ -10,7 +16,7 @@ module Luna
10
16
  include Profile
11
17
 
12
18
  if Gem::Version.new(::RSpec::Version::STRING) >= Gem::Version.new("3.0")
13
- ::RSpec::Core::Formatters.register self, *[
19
+ then Object::RSpec::Core::Formatters.register self, *[
14
20
  :start,
15
21
  :start_dump,
16
22
  :example_passed,
@@ -20,6 +26,8 @@ module Luna
20
26
  ]
21
27
  end
22
28
 
29
+ # --------------------------------------------------------------------
30
+
23
31
  [:success, :failure, :pending].each do |m|
24
32
  define_method "#{m}_color" do |v|
25
33
  defined?(super) ? super(v) : ::RSpec::Core::Formatters::ConsoleCodes.wrap(
@@ -28,14 +36,20 @@ module Luna
28
36
  end
29
37
  end
30
38
 
31
- def start(*args)
39
+ # --------------------------------------------------------------------
40
+
41
+ def start(_)
32
42
  output.puts
33
43
  end
34
44
 
35
- def start_dump(*args)
45
+ # --------------------------------------------------------------------
46
+
47
+ def start_dump(_)
36
48
  output.puts
37
49
  end
38
50
 
51
+ # --------------------------------------------------------------------
52
+
39
53
  def example_passed(struct)
40
54
  output.print "\s"
41
55
  print_description(
@@ -43,6 +57,8 @@ module Luna
43
57
  )
44
58
  end
45
59
 
60
+ # --------------------------------------------------------------------
61
+
46
62
  def example_failed(struct)
47
63
  output.print "\s"
48
64
  print_description(
@@ -50,6 +66,8 @@ module Luna
50
66
  )
51
67
  end
52
68
 
69
+ # --------------------------------------------------------------------
70
+
53
71
  def example_pending(struct)
54
72
  output.print "\s"
55
73
  print_description(
@@ -57,11 +75,15 @@ module Luna
57
75
  )
58
76
  end
59
77
 
78
+ # --------------------------------------------------------------------
79
+
60
80
  def get_example(struct)
61
81
  return struct unless struct.respond_to?(:example)
62
82
  struct.example
63
83
  end
64
84
 
85
+ # --------------------------------------------------------------------
86
+
65
87
  def print_description(example, type)
66
88
  output.print send(
67
89
  :"#{type}_color", " " + example.full_description + "\n"
@@ -1,11 +1,17 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
1
7
  require "luna/rspec/formatters/emoji"
2
8
 
3
9
  module Luna
4
10
  module RSpec
5
11
  module Formatters
6
12
  class Hearts < Emoji
7
- if Gem::Version.new(::RSpec::Version::STRING) >= Gem::Version.new("3.0")
8
- ::RSpec::Core::Formatters.register self, *[
13
+ if Gem::Version.new(Object::RSpec::Version::STRING) >= Gem::Version.new("3.0")
14
+ then Object::RSpec::Core::Formatters.register self, *[
9
15
  :start,
10
16
  :start_dump,
11
17
  :example_passed,
@@ -15,21 +21,27 @@ module Luna
15
21
  ]
16
22
  end
17
23
 
18
- def example_passed(e)
24
+ # --------------------------------------------------------------------
25
+
26
+ def example_passed(_)
19
27
  newline_or_addup
20
28
  output.print " ".freeze, success_color(
21
29
  "\u2764"
22
30
  )
23
31
  end
24
32
 
25
- def example_failed(e)
33
+ # --------------------------------------------------------------------
34
+
35
+ def example_failed(_)
26
36
  newline_or_addup
27
37
  output.print " ".freeze, failure_color(
28
38
  "\u1F494"
29
39
  )
30
40
  end
31
41
 
32
- def example_pending(e)
42
+ # --------------------------------------------------------------------
43
+
44
+ def example_pending(_)
33
45
  newline_or_addup
34
46
  output.print " ".freeze, pending_color(
35
47
  "\u2764"
@@ -1,17 +1,26 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
1
7
  module Luna
2
8
  module RSpec
3
9
  module Formatters
4
10
  module Profile
5
- GROUPS = " %{location} \u2910 %{count} for %{total}"
11
+ GROUPS = " %{location} \u2910 %{count} for %{total}"
6
12
  EXAMPLES_HEADER = "\nTop %{size} slowest examples (%{seconds}s), %{per_cent}%% of total time:\n"
7
- GROUPS_HEADER = "\nTop %{size} slowest example groups:"
8
- EXAMPLES = " %{location} \u2910 %{seconds}"
13
+ GROUPS_HEADER = "\nTop %{size} slowest example groups:"
14
+ EXAMPLES = " %{location} \u2910 %{seconds}"
9
15
 
16
+ # --------------------------------------------------------------------
10
17
 
11
18
  def helpers
12
- ::RSpec::Core::Formatters::Helpers
19
+ Object::RSpec::Core::Formatters::Helpers
13
20
  end
14
21
 
22
+ # --------------------------------------------------------------------
23
+
15
24
  def dump_profile(profile)
16
25
  dump_profile_slowest_examples(profile)
17
26
  dump_profile_slowest_example_groups(
@@ -19,62 +28,76 @@ module Luna
19
28
  )
20
29
  end
21
30
 
31
+ # --------------------------------------------------------------------
32
+
22
33
  private
23
34
  def dump_profile_slowest_examples(profile)
24
35
  examples_header(profile)
36
+
25
37
  profile.slowest_examples.each do |e|
26
- sec = helpers.format_seconds(e.execution_result.run_time) + \
27
- " seconds"
38
+ sec = helpers.format_seconds(e.execution_result.run_time) + " seconds"
28
39
 
29
40
  @output.puts EXAMPLES % {
30
- location: format_caller(e.location),
31
- seconds: sec.to_f < 1 ? success_color(sec) : failure_color(sec),
32
- description: e.full_description
41
+ :location => format_caller(e.location),
42
+ :seconds => sec.to_f < 1 ? success_color(sec) : failure_color(sec),
43
+ :description => e.full_description
33
44
  }
34
45
  end
35
46
  end
36
47
 
48
+ # --------------------------------------------------------------------
49
+
37
50
  def dump_profile_slowest_example_groups(profile)
38
51
  groups_header(profile)
52
+
39
53
  profile.slowest_groups.each do |l, h|
40
- sec = helpers.format_seconds(h[:total_time]) + \
41
- "seconds"
54
+ sec = helpers.format_seconds(h[:total_time]) + "seconds"
42
55
 
43
56
  @output.puts color_blue(GROUPS % {
44
- description: h[:description],
45
- total: sec.to_f < 2 ? success_color(sec) : failure_color(sec),
46
- location: color_blue(strip_relative(l)),
47
- count: h[:count]
57
+ :description => h[:description],
58
+ :total => sec.to_f < 2 ? success_color(sec) : failure_color(sec),
59
+ :location => color_blue(strip_relative(l)),
60
+ :count => h[:count]
48
61
  })
49
62
  end
50
63
  end
51
64
 
65
+ # --------------------------------------------------------------------
66
+
52
67
  def groups_header(profile)
53
68
  @output.puts GROUPS_HEADER % {
54
- size: profile.slowest_groups.size
69
+ :size => profile.slowest_groups.size
55
70
  }
56
71
  end
57
72
 
73
+ # --------------------------------------------------------------------
74
+
58
75
  def examples_header(profile)
59
76
  @output.puts EXAMPLES_HEADER % {
60
- size: profile.slowest_examples.size,
61
- seconds: helpers.format_seconds(profile.slow_duration),
62
- per_cent: profile.percentage
77
+ :size => profile.slowest_examples.size,
78
+ :seconds => helpers.format_seconds(profile.slow_duration),
79
+ :per_cent => profile.percentage
63
80
  }
64
81
  end
65
82
 
83
+ # --------------------------------------------------------------------
84
+
66
85
  def color_blue(str)
67
- ::RSpec::Core::Formatters::ConsoleCodes.wrap(
86
+ Object::RSpec::Core::Formatters::ConsoleCodes.wrap(
68
87
  str, :cyan
69
88
  )
70
89
  end
71
90
 
91
+ # --------------------------------------------------------------------
92
+
72
93
  def strip_relative(path)
73
94
  path.gsub(
74
95
  /\A\.\//, ""
75
96
  )
76
97
  end
77
98
 
99
+ # --------------------------------------------------------------------
100
+
78
101
  def format_caller(caller_info)
79
102
  color_blue strip_relative(::RSpec.configuration.backtrace_formatter.backtrace_line(
80
103
  caller_info.to_s.split(':in `block').first
@@ -1,11 +1,17 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
1
7
  require "luna/rspec/formatters/emoji"
2
8
 
3
9
  module Luna
4
10
  module RSpec
5
11
  module Formatters
6
12
  class Smilies < Emoji
7
- if Gem::Version.new(::RSpec::Version::STRING) >= Gem::Version.new("3.0")
8
- ::RSpec::Core::Formatters.register self, *[
13
+ if Gem::Version.new(Object::RSpec::Version::STRING) >= Gem::Version.new("3.0")
14
+ then Object::RSpec::Core::Formatters.register self, *[
9
15
  :start,
10
16
  :start_dump,
11
17
  :example_passed,
@@ -15,21 +21,27 @@ module Luna
15
21
  ]
16
22
  end
17
23
 
18
- def example_passed(e)
24
+ # --------------------------------------------------------------------
25
+
26
+ def example_passed(_)
19
27
  newline_or_addup
20
28
  output.print " ".freeze, success_color(
21
29
  "\u263A"
22
30
  )
23
31
  end
24
32
 
25
- def example_failed(e)
33
+ # --------------------------------------------------------------------
34
+
35
+ def example_failed(_)
26
36
  newline_or_addup
27
37
  output.print " ".freeze, failure_color(
28
38
  "\u2639"
29
39
  )
30
40
  end
31
41
 
32
- def example_pending(e)
42
+ # --------------------------------------------------------------------
43
+
44
+ def example_pending(_)
33
45
  newline_or_addup
34
46
  output.print " ".freeze, pending_color(
35
47
  "\u2639"
@@ -1,7 +1,13 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2015 - 2016 Jordon Bedwell - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
1
7
  module Luna
2
8
  module Rspec
3
9
  module Formatters
4
- VERSION = "3.4.0"
10
+ VERSION = "3.5.0"
5
11
  end
6
12
  end
7
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.4.0
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordon Bedwell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-12 00:00:00.000000000 Z
11
+ date: 2016-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -50,7 +50,7 @@ files:
50
50
  - lib/luna/rspec/formatters/version.rb
51
51
  homepage: https://github.com/envygeeks/luna-rspec-formatters
52
52
  licenses:
53
- - Apache 2.0
53
+ - MIT
54
54
  metadata: {}
55
55
  post_install_message:
56
56
  rdoc_options: []
@@ -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.0
71
+ rubygems_version: 2.5.1
72
72
  signing_key:
73
73
  specification_version: 4
74
74
  summary: RSpec formatters dedicated to Luna.