luna-rspec-formatters 0.4.3 → 0.6.0

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: c2dfb401a5baa9f27a89f68666b7133bac44c69b
4
- data.tar.gz: 99f2a2bb57a8c8f88a8eec4087b6b13a7ade6bf2
3
+ metadata.gz: 5683ea48f61e615c9176909f8dbc9e78e1e8da0b
4
+ data.tar.gz: f70b5e2d995daadca67664068d7fe41daf4854d2
5
5
  SHA512:
6
- metadata.gz: e9dac8d1a2227368e56bea3fe6cb4eae1324ecea266bab58bf78b09099e6ea694c0cafb88b85b7fce84073dfd66efe5df13a01f72268634a9cae22b55436b335
7
- data.tar.gz: ab4be85ff1cbf2e12f0a1470382c54564f2286668f4ff649a737cc867ceb1d5da934dcd2a910eb564ac29c6939af54d8d488477715d0dd6cc497e87d8d32167c
6
+ metadata.gz: 323b43f4969c5305105fd2460d47836a773c4a0e734ac7f3f9a484b17f0fa364fdc36c356324da7b88e6f35feb9ad7faf44cd7869054721d4104a1a248e5d303
7
+ data.tar.gz: 5a24752ee991e5f2722f48d41fc4307a92b91b1d811fd0949a55bfc1d75e5b858826ceec955cfa671cb047cc3707eed1b09d4caacf5de12097396f2acc5affee
data/Gemfile CHANGED
@@ -8,3 +8,10 @@ group :development do
8
8
 
9
9
  gem "rake"
10
10
  end
11
+
12
+ group :test do
13
+ case ENV["RSPEC_VERSION"]
14
+ when "beta" then gem "rspec", "~> 3.0.0.beta1"
15
+ when "stable" then gem "rspec", "~> 2.14"
16
+ end
17
+ end
@@ -17,45 +17,27 @@ end
17
17
  module Luna
18
18
  module RSpec
19
19
  module Formatters
20
- MethodMap = {
21
- :passed => ["\u2713", :green],
22
- :failed => ["\u2718", :red],
23
- :pending => ["\u203D", :yellow]
24
- }
25
-
26
20
  class Base < ::RSpec::Core::Formatters::BaseTextFormatter
27
-
28
- # --------------------------------------------------------------------
29
- # Outputs a blank line at the beginning of the marks.
30
- # --------------------------------------------------------------------
31
-
32
21
  def start(*args)
33
22
  super
34
23
  output.puts
35
24
  end
36
25
 
37
- # --------------------------------------------------------------------
38
- # Outputs a blank line at the end of the marks.
39
- # --------------------------------------------------------------------
40
-
41
26
  def start_dump
42
27
  super
43
28
  output.puts
44
29
  end
45
30
 
46
- # --------------------------------------------------------------------
47
- # Passes to super and then libnotify.
48
- # --------------------------------------------------------------------
49
-
50
31
  def dump_summary(duration, total, failures, pending)
51
32
  super
52
33
  Libnotify.new do |notify|
53
- notify.summary = "RSpec Results"
34
+ notify.summary = "RSpec Test Results"
54
35
  notify.urgency = :critical
55
- notify.timeout = 1
56
- notify.append = false
57
36
  notify.transient = true
58
- notify.body = "Passed: #{total - failures}, Failed: #{failures}"
37
+ notify.append = true
38
+ notify.timeout = 1
39
+ notify.body = \
40
+ "Passed: #{total - failures}, Failed: #{failures}, Pending: #{pending}"
59
41
  end.show!
60
42
  end
61
43
  end
@@ -4,16 +4,22 @@ module Luna
4
4
  module RSpec
5
5
  module Formatters
6
6
  class Checks < Base
7
+ def example_passed(e)
8
+ super(e)
9
+ output.print("\s")
10
+ output.print(success_color("\u2713"))
11
+ end
7
12
 
8
- # --------------------------------------------------------------------
9
- # Checkmark, x and ?! with the colors green, red and yellow.
10
- # --------------------------------------------------------------------
13
+ def example_failed(e)
14
+ super(e)
15
+ output.print("\s")
16
+ output.print(failed_color("\u2718"))
17
+ end
11
18
 
12
- MethodMap.each do |m, u|
13
- define_method("example_#{m}") do |e|
14
- super(e)
15
- output.print " #{u.first}".send(u.last)
16
- end
19
+ def example_pending(e)
20
+ super(e)
21
+ output.print("\s")
22
+ output.print(pending_color("\u203D"))
17
23
  end
18
24
  end
19
25
  end
@@ -6,48 +6,40 @@ module Luna
6
6
  module Formatters
7
7
  class Documentation < Base
8
8
 
9
- # --------------------------------------------------------------------
10
- # example_passed, example_pending, example_failed.
11
- # --------------------------------------------------------------------
12
-
13
- MethodMap.each do |m, u|
14
- define_method("example_#{m}") do |e|
15
- super(e)
16
- blank_line?
17
- print_description(e)
18
- output.puts " #{u.first}".send(u.last)
19
- end
9
+ def example_passed
10
+ super(e)
11
+ blank_line?
12
+ success_color(print_description(e))
20
13
  end
21
14
 
22
- # --------------------------------------------------------------------
23
- # A simple wrapper for CodeRay and syntax highlighting.
24
- # --------------------------------------------------------------------
15
+ def example_failed
16
+ super(e)
17
+ blank_line?
18
+ failed_color(print_description(e))
19
+ end
25
20
 
26
- def syntax_highlight(text)
27
- CodeRay.scan(text, :ruby).term
21
+ def example_pending
22
+ super(e)
23
+ blank_line?
24
+ pending_color(print_description(e))
28
25
  end
29
26
 
30
- # --------------------------------------------------------------------
31
- # Searches for `` inside of "it" and and highlights it with CodeRay.
32
- # --------------------------------------------------------------------
27
+ # -------------------------------------------------------------
33
28
 
34
29
  def highlight_graves(text)
35
30
  text.gsub(/`([^`]+)`/) { syntax_highlight($1) }
36
31
  end
37
32
 
38
- # --------------------------------------------------------------------
39
- # Searches for anything that starts with \. or # and colors it.
40
- # --------------------------------------------------------------------
33
+ def syntax_highlight(text)
34
+ CodeRay.scan(text, :ruby).term
35
+ end
36
+
41
37
 
42
38
  def highlight_methods(text)
43
39
  text.gsub(/(#|\.)([a-z0-9_]+)/) { $1.white + $2.magenta }
44
40
  end
45
41
 
46
- # --------------------------------------------------------------------
47
- # Strips apart the full_description to attempt to gather information
48
- # on the constant and method and then highlights and outputs
49
- # everything.
50
- # --------------------------------------------------------------------
42
+ # -------------------------------------------------------------
51
43
 
52
44
  def print_description(example)
53
45
  constant = example.full_description.chomp(example.description)
@@ -1,7 +1,7 @@
1
1
  module Luna
2
2
  module Rspec
3
3
  module Formatters
4
- VERSION = "0.4.3"
4
+ VERSION = "0.6.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,57 +1,63 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: luna-rspec-formatters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.6.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: 2013-09-13 00:00:00.000000000 Z
11
+ date: 2013-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rspec
14
+ name: term-ansicolor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.14'
19
+ version: '1.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.14'
26
+ version: '1.2'
27
27
  - !ruby/object:Gem::Dependency
28
- name: libnotify
28
+ name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0.8'
33
+ version: '2.14'
34
+ - - "<="
35
+ - !ruby/object:Gem::Version
36
+ version: '3.1'
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - ~>
41
+ - - ">="
39
42
  - !ruby/object:Gem::Version
40
- version: '0.8'
43
+ version: '2.14'
44
+ - - "<="
45
+ - !ruby/object:Gem::Version
46
+ version: '3.1'
41
47
  - !ruby/object:Gem::Dependency
42
- name: term-ansicolor
48
+ name: libnotify
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - ~>
51
+ - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '1.2'
53
+ version: '0.8'
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
- - - ~>
58
+ - - "~>"
53
59
  - !ruby/object:Gem::Version
54
- version: '1.2'
60
+ version: '0.8'
55
61
  description: A couple of RSpec formatters.
56
62
  email:
57
63
  - envygeeks@gmail.com
@@ -59,13 +65,13 @@ executables: []
59
65
  extensions: []
60
66
  extra_rdoc_files: []
61
67
  files:
62
- - lib/luna/rspec/formatters/checks.rb
63
- - lib/luna/rspec/formatters/version.rb
64
- - lib/luna/rspec/formatters/documentation.rb
65
- - lib/luna/rspec/formatters/base.rb
68
+ - Gemfile
66
69
  - License
67
70
  - Readme.md
68
- - Gemfile
71
+ - lib/luna/rspec/formatters/base.rb
72
+ - lib/luna/rspec/formatters/checks.rb
73
+ - lib/luna/rspec/formatters/documentation.rb
74
+ - lib/luna/rspec/formatters/version.rb
69
75
  homepage: https://github.com/envygeeks/luna-rspec-formatters
70
76
  licenses:
71
77
  - Apache 2.0
@@ -76,17 +82,17 @@ require_paths:
76
82
  - lib
77
83
  required_ruby_version: !ruby/object:Gem::Requirement
78
84
  requirements:
79
- - - '>='
85
+ - - ">="
80
86
  - !ruby/object:Gem::Version
81
87
  version: '0'
82
88
  required_rubygems_version: !ruby/object:Gem::Requirement
83
89
  requirements:
84
- - - '>='
90
+ - - ">="
85
91
  - !ruby/object:Gem::Version
86
92
  version: '0'
87
93
  requirements: []
88
94
  rubyforge_project:
89
- rubygems_version: 2.1.3
95
+ rubygems_version: 2.2.0.rc.1
90
96
  signing_key:
91
97
  specification_version: 4
92
98
  summary: A couple of RSpec formatters the way I like them.