growl-rspec 0.0.1 → 0.0.2

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7f053dd287da80cc527d2938c1a90df15106e21a
4
+ data.tar.gz: 016a6560828c551bc75acb777de05469d5d07061
5
+ SHA512:
6
+ metadata.gz: 964e88e0eb8281db877796f6378aa8805c5800162bf80e7ec5cddca6c1126abe5ffe653aa212aeaaf063d334184f85ed5035b10b3663e74eefe48c841f2eaf37
7
+ data.tar.gz: 6ed8cd71fad31b17a4c73c85391467168161bd957bbfddb9d7e6e2ba9fb4c6b0f180daaf2447391c41cc1add41d24a70d619af4ba459718d4309c9fea3bd9096
@@ -1,77 +1,81 @@
1
1
  require 'rspec/core/formatters/base_text_formatter'
2
2
 
3
- module Growl::RSpec
4
- # The Growl::RSpec::Formatter depens on the growl gem
5
- # (and therefore, growlnotify bin must be installed)
6
- #
7
- # Use it by putting this in your spec_helper.rb
8
- # RSpec.configure do |config|
9
- # config.formatter = 'Growl::RSpec::Formatter'
10
- # end
11
- #
12
- # You can switch off granular growls about each spec failure via:
13
- # Growl::RSpec::Formatter.config = {
14
- # :growl_failures => false
15
- # }
16
- #
17
- # You can configure additional growlnotify options like:
18
- # Growl::RSpec::Formatter.growlnotify_config = {
19
- # :host => 'your.growl.host'
20
- # }
21
- #
22
- class Formatter < RSpec::Core::Formatters::BaseTextFormatter
3
+ module Growl
4
+ module RSpec
5
+ # The Growl::RSpec::Formatter depens on the growl gem
6
+ # (and therefore, growlnotify bin must be installed)
7
+ #
8
+ # Use it by putting this in your spec_helper.rb
9
+ # RSpec.configure do |config|
10
+ # config.formatter = 'Growl::RSpec::Formatter'
11
+ # end
12
+ #
13
+ # You can switch off granular growls about each spec failure via:
14
+ # Growl::RSpec::Formatter.config = {
15
+ # :growl_failures => false
16
+ # }
17
+ #
18
+ # You can configure additional growlnotify options like:
19
+ # Growl::RSpec::Formatter.growlnotify_config = {
20
+ # :host => 'your.growl.host'
21
+ # }
22
+ #
23
+ class Formatter < ::RSpec::Core::Formatters::BaseTextFormatter
23
24
 
24
- # the formatters default config hash
25
- DEFAULT_CONFIG = {
26
- :growl_failures => true
27
- }.freeze
25
+ # the formatters default config hash
26
+ DEFAULT_CONFIG = {
27
+ :growl_failures => true
28
+ }.freeze
28
29
 
29
- # read the formatters config hash
30
- def self.config
31
- @@config ||= DEFAULT_CONFIG
32
- end
30
+ # read the formatters config hash
31
+ def self.config
32
+ @@config ||= DEFAULT_CONFIG
33
+ end
33
34
 
34
- # set the formatters config hash
35
- def self.config=(c)
36
- @@config = DEFAULT_CONFIG.dup.merge(c)
37
- end
35
+ # set the formatters config hash
36
+ def self.config=(c)
37
+ @@config = DEFAULT_CONFIG.dup.merge(c)
38
+ end
38
39
 
39
- # set the config hash that is passed to growlnotify gem
40
- def self.growlnotify_config=(o)
41
- @@_growlnotify_config = o
42
- end
40
+ # set the config hash that is passed to growlnotify gem
41
+ def self.growlnotify_config=(o)
42
+ @@_growlnotify_config = o
43
+ end
43
44
 
44
- # get the config hash that is passed to growlnotify gem
45
- def self.growlnotify_config
46
- @@_growlnotify_config ||= {}
47
- end
45
+ # get the config hash that is passed to growlnotify gem
46
+ def self.growlnotify_config
47
+ @@_growlnotify_config ||= {}
48
+ end
48
49
 
49
- # hook when spec failed
50
- def dump_failures
51
- super
52
- return if failed_examples.empty?
53
- if self.class.config[:growl_failures]
50
+ # hook when spec failed
51
+ def dump_failures
52
+ return if failed_examples.empty?
53
+ if self.class.config[:growl_failures]
54
54
 
55
- msg = failed_examples.each_with_index.map do |example, idx|
56
- ["#{idx+1}. it #{example.description}",
57
- example.metadata[:execution_result][:exception]]
58
- end.flatten.join("\n\n")
55
+ msg = failed_examples.each_with_index.map do |example, idx|
56
+ ["#{idx+1}. it #{example.description}",
57
+ example.metadata[:execution_result][:exception]]
58
+ end.flatten.join("\n\n")
59
59
 
60
- ::Growl.notify_warning msg, {
61
- :title => "#{failed_examples.size} specs failed"
62
- }.merge(self.class.growlnotify_config)
60
+ ::Growl.notify_warning msg, {
61
+ :title => "#{failed_examples.size} specs failed"
62
+ }.merge(self.class.growlnotify_config)
63
+ end
63
64
  end
64
- end
65
65
 
66
- # hook when all specs ran
67
- def dump_summary(duration, example_count, failure_count, pending_count)
68
- super(duration, example_count, failure_count, pending_count)
66
+ # hook when all specs ran
67
+ def dump_summary(duration, example_count, failure_count, pending_count)
68
+ msg = "#{example_count} specs in total (#{pending_count} pending). "\
69
+ "Consumed #{duration.round(1)}s"
69
70
 
70
- msg = "#{example_count} specs in total (#{pending_count} pending). "\
71
- "Consumed #{duration.round(1)}s"
72
- ::Growl.notify_info msg, {
73
- :title => "#{failure_count} specs failed!"
74
- }.merge(self.class.growlnotify_config)
71
+ title = if failure_count == 0
72
+ "All specs passed."
73
+ else
74
+ "#{failure_count} specs failed!"
75
+ end
76
+
77
+ ::Growl.notify_info msg, { :title => title }.merge(self.class.growlnotify_config)
78
+ end
75
79
  end
76
80
  end
77
- end
81
+ end
@@ -1,5 +1,5 @@
1
1
  module Growl
2
2
  module RSpec
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,38 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: growl-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - dpree
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2011-10-25 00:00:00.000000000Z
11
+ date: 2014-07-09 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
- requirement: &70335085579380 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *70335085579380
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: growl
27
- requirement: &70335085576660 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - '>='
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0'
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *70335085576660
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
36
41
  description: Provides a new RSpec formatter that uses growlnotify
37
42
  email:
38
43
  - whiterabbit.init@gmail.com
@@ -52,26 +57,25 @@ files:
52
57
  - lib/growl/rspec/version.rb
53
58
  homepage: https://github.com/dpree/growl-rspec
54
59
  licenses: []
60
+ metadata: {}
55
61
  post_install_message:
56
62
  rdoc_options: []
57
63
  require_paths:
58
64
  - lib
59
65
  required_ruby_version: !ruby/object:Gem::Requirement
60
- none: false
61
66
  requirements:
62
- - - ! '>='
67
+ - - '>='
63
68
  - !ruby/object:Gem::Version
64
69
  version: '0'
65
70
  required_rubygems_version: !ruby/object:Gem::Requirement
66
- none: false
67
71
  requirements:
68
- - - ! '>='
72
+ - - '>='
69
73
  - !ruby/object:Gem::Version
70
74
  version: '0'
71
75
  requirements: []
72
76
  rubyforge_project: growl-rspec
73
- rubygems_version: 1.8.10
77
+ rubygems_version: 2.0.3
74
78
  signing_key:
75
- specification_version: 3
79
+ specification_version: 4
76
80
  summary: Publishing RSpec results via Growl
77
81
  test_files: []