growl-rspec 0.0.2 → 3.0.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: 7f053dd287da80cc527d2938c1a90df15106e21a
4
- data.tar.gz: 016a6560828c551bc75acb777de05469d5d07061
3
+ metadata.gz: 677939ced7319cf872a799add2611c1938f1299b
4
+ data.tar.gz: d051521578eb0025d9f360f302e803e1195513e6
5
5
  SHA512:
6
- metadata.gz: 964e88e0eb8281db877796f6378aa8805c5800162bf80e7ec5cddca6c1126abe5ffe653aa212aeaaf063d334184f85ed5035b10b3663e74eefe48c841f2eaf37
7
- data.tar.gz: 6ed8cd71fad31b17a4c73c85391467168161bd957bbfddb9d7e6e2ba9fb4c6b0f180daaf2447391c41cc1add41d24a70d619af4ba459718d4309c9fea3bd9096
6
+ metadata.gz: 644f75b54a7a275c2d912f93fad42efdea18373a33884dc47a64f26b44c55a2d4c412ba50474ff248c0cbac403cc4642e00adcd8d2ec592c04eba6c5849bef67
7
+ data.tar.gz: f33185293f7ea7e844749b0566328ab9a9a9679740e81e8291ab28060ad7f131aa5230c72151cf693c69c2273840c9b8a0ae6f1886d3ef94a3e23e5cf46defea
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --warnings
3
+ --require spec_helper
data/README.md CHANGED
@@ -19,3 +19,7 @@ Further information have a look at lib/growl/rspec/formatter.rb
19
19
  ## License
20
20
 
21
21
  see MIT-LICENSE
22
+
23
+
24
+ [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/dpree/growl-rspec/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
25
+
@@ -0,0 +1,4 @@
1
+ --color
2
+ --warnings
3
+ --format Growl::RSpec::Formatter
4
+ --require spec_helper
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'growl-rspec', path: '..'
@@ -0,0 +1,17 @@
1
+ describe 'Some examples' do
2
+ it 'succeeds' do
3
+ expect(true).to eq(true)
4
+ end
5
+
6
+ it 'pends' do
7
+ pending 'a pending example'
8
+ end
9
+
10
+ it 'fails' do
11
+ expect(false).to eq(true)
12
+ end
13
+
14
+ it 'fails too' do
15
+ expect(false).to eq(true)
16
+ end
17
+ end
@@ -0,0 +1,82 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
2
+ require 'growl-rspec'
3
+
4
+ # This file was generated by the `rspec --init` command. Conventionally, all
5
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
6
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
7
+ # file to always be loaded, without a need to explicitly require it in any files.
8
+ #
9
+ # Given that it is always loaded, you are encouraged to keep this file as
10
+ # light-weight as possible. Requiring heavyweight dependencies from this file
11
+ # will add to the boot time of your test suite on EVERY test run, even for an
12
+ # individual file that may not need all of that loaded. Instead, make a
13
+ # separate helper file that requires this one and then use it only in the specs
14
+ # that actually need it.
15
+ #
16
+ # The `.rspec` file also contains a few flags that are not defaults but that
17
+ # users commonly want.
18
+ #
19
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
20
+ RSpec.configure do |config|
21
+ config.default_formatter = 'Growl::RSpec::Formatter'
22
+ # The settings below are suggested to provide a good initial experience
23
+ # with RSpec, but feel free to customize to your heart's content.
24
+ =begin
25
+ # These two settings work together to allow you to limit a spec run
26
+ # to individual examples or groups you care about by tagging them with
27
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
28
+ # get run.
29
+ config.filter_run :focus
30
+ config.run_all_when_everything_filtered = true
31
+
32
+ # Many RSpec users commonly either run the entire suite or an individual
33
+ # file, and it's useful to allow more verbose output when running an
34
+ # individual spec file.
35
+ if config.files_to_run.one?
36
+ # Use the documentation formatter for detailed output,
37
+ # unless a formatter has already been configured
38
+ # (e.g. via a command-line flag).
39
+ config.default_formatter = 'doc'
40
+ end
41
+
42
+ # Print the 10 slowest examples and example groups at the
43
+ # end of the spec run, to help surface which specs are running
44
+ # particularly slow.
45
+ config.profile_examples = 10
46
+
47
+ # Run specs in random order to surface order dependencies. If you find an
48
+ # order dependency and want to debug it, you can fix the order by providing
49
+ # the seed, which is printed after each run.
50
+ # --seed 1234
51
+ config.order = :random
52
+
53
+ # Seed global randomization in this process using the `--seed` CLI option.
54
+ # Setting this allows you to use `--seed` to deterministically reproduce
55
+ # test failures related to randomization by passing the same `--seed` value
56
+ # as the one that triggered the failure.
57
+ Kernel.srand config.seed
58
+
59
+ # rspec-expectations config goes here. You can use an alternate
60
+ # assertion/expectation library such as wrong or the stdlib/minitest
61
+ # assertions if you prefer.
62
+ config.expect_with :rspec do |expectations|
63
+ # Enable only the newer, non-monkey-patching expect syntax.
64
+ # For more details, see:
65
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
66
+ expectations.syntax = :expect
67
+ end
68
+
69
+ # rspec-mocks config goes here. You can use an alternate test double
70
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
71
+ config.mock_with :rspec do |mocks|
72
+ # Enable only the newer, non-monkey-patching expect syntax.
73
+ # For more details, see:
74
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
75
+ mocks.syntax = :expect
76
+
77
+ # Prevents you from mocking or stubbing a method that does not exist on
78
+ # a real object. This is generally recommended.
79
+ mocks.verify_partial_doubles = true
80
+ end
81
+ =end
82
+ end
@@ -20,6 +20,6 @@ Gem::Specification.new do |s|
20
20
 
21
21
  # specify any dependencies here; for example:
22
22
  # s.add_development_dependency "rspec"
23
- s.add_runtime_dependency "rspec"
23
+ s.add_runtime_dependency "rspec", "~> 3.0"
24
24
  s.add_runtime_dependency "growl"
25
25
  end
@@ -1,4 +1,4 @@
1
- require 'rspec/core/formatters/base_text_formatter'
1
+ require 'rspec/core/formatters'
2
2
 
3
3
  module Growl
4
4
  module RSpec
@@ -20,7 +20,8 @@ module Growl
20
20
  # :host => 'your.growl.host'
21
21
  # }
22
22
  #
23
- class Formatter < ::RSpec::Core::Formatters::BaseTextFormatter
23
+ class Formatter
24
+ ::RSpec::Core::Formatters.register self, :dump_failures, :dump_summary
24
25
 
25
26
  # the formatters default config hash
26
27
  DEFAULT_CONFIG = {
@@ -47,31 +48,35 @@ module Growl
47
48
  @@_growlnotify_config ||= {}
48
49
  end
49
50
 
51
+ def initialize output
52
+ @output = output
53
+ end
54
+
50
55
  # hook when spec failed
51
- def dump_failures
52
- return if failed_examples.empty?
56
+ def dump_failures(examples_notification)
57
+ return if examples_notification.failed_examples.empty?
53
58
  if self.class.config[:growl_failures]
54
59
 
55
- msg = failed_examples.each_with_index.map do |example, idx|
60
+ msg = examples_notification.failed_examples.each_with_index.map do |example, idx|
56
61
  ["#{idx+1}. it #{example.description}",
57
62
  example.metadata[:execution_result][:exception]]
58
63
  end.flatten.join("\n\n")
59
64
 
60
65
  ::Growl.notify_warning msg, {
61
- :title => "#{failed_examples.size} specs failed"
66
+ :title => "#{examples_notification.failed_examples.size} specs failed"
62
67
  }.merge(self.class.growlnotify_config)
63
68
  end
64
69
  end
65
70
 
66
71
  # 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"
72
+ def dump_summary(summary)
73
+ msg = "#{summary.example_count} specs in total (#{summary.pending_count} pending). "\
74
+ "Consumed #{summary.duration.round(1)}s"
70
75
 
71
- title = if failure_count == 0
76
+ title = if summary.failure_count == 0
72
77
  "All specs passed."
73
78
  else
74
- "#{failure_count} specs failed!"
79
+ "#{summary.failure_count} specs failed!"
75
80
  end
76
81
 
77
82
  ::Growl.notify_info msg, { :title => title }.merge(self.class.growlnotify_config)
@@ -1,5 +1,5 @@
1
1
  module Growl
2
2
  module RSpec
3
- VERSION = "0.0.2"
3
+ VERSION = "3.0.0"
4
4
  end
5
5
  end
@@ -0,0 +1,27 @@
1
+ describe Growl::RSpec::Formatter do
2
+ it 'dumps failures' do
3
+ expect(::Growl).to receive(:notify).with(
4
+ "1. it foo\n\nbar",
5
+ {:title=>"1 specs failed",
6
+ :image=>kind_of(String)})
7
+ example = double('example')
8
+ example.stub('description') { 'foo' }
9
+ example.stub('metadata') { {:execution_result => {:exception => 'bar'}} }
10
+ examples_notification = double('examples_notification')
11
+ examples_notification.stub('failed_examples') { [example] }
12
+ subject.dump_failures examples_notification
13
+ end
14
+
15
+ it 'dumps summary' do
16
+ expect(::Growl).to receive(:notify).with(
17
+ "10 specs in total (1 pending). Consumed 5.5s", {
18
+ :title=>"5 specs failed!",
19
+ :image=>kind_of(String)})
20
+ summary = double('summary')
21
+ summary.stub('duration') { 5.5 }
22
+ summary.stub('example_count') { 10 }
23
+ summary.stub('pending_count') { 1 }
24
+ summary.stub('failure_count') { 5 }
25
+ subject.dump_summary summary
26
+ end
27
+ end
@@ -0,0 +1,81 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
2
+ require 'growl-rspec'
3
+
4
+ # This file was generated by the `rspec --init` command. Conventionally, all
5
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
6
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
7
+ # file to always be loaded, without a need to explicitly require it in any files.
8
+ #
9
+ # Given that it is always loaded, you are encouraged to keep this file as
10
+ # light-weight as possible. Requiring heavyweight dependencies from this file
11
+ # will add to the boot time of your test suite on EVERY test run, even for an
12
+ # individual file that may not need all of that loaded. Instead, make a
13
+ # separate helper file that requires this one and then use it only in the specs
14
+ # that actually need it.
15
+ #
16
+ # The `.rspec` file also contains a few flags that are not defaults but that
17
+ # users commonly want.
18
+ #
19
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
20
+ RSpec.configure do |config|
21
+ # The settings below are suggested to provide a good initial experience
22
+ # with RSpec, but feel free to customize to your heart's content.
23
+ =begin
24
+ # These two settings work together to allow you to limit a spec run
25
+ # to individual examples or groups you care about by tagging them with
26
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
27
+ # get run.
28
+ config.filter_run :focus
29
+ config.run_all_when_everything_filtered = true
30
+
31
+ # Many RSpec users commonly either run the entire suite or an individual
32
+ # file, and it's useful to allow more verbose output when running an
33
+ # individual spec file.
34
+ if config.files_to_run.one?
35
+ # Use the documentation formatter for detailed output,
36
+ # unless a formatter has already been configured
37
+ # (e.g. via a command-line flag).
38
+ config.default_formatter = 'doc'
39
+ end
40
+
41
+ # Print the 10 slowest examples and example groups at the
42
+ # end of the spec run, to help surface which specs are running
43
+ # particularly slow.
44
+ config.profile_examples = 10
45
+
46
+ # Run specs in random order to surface order dependencies. If you find an
47
+ # order dependency and want to debug it, you can fix the order by providing
48
+ # the seed, which is printed after each run.
49
+ # --seed 1234
50
+ config.order = :random
51
+
52
+ # Seed global randomization in this process using the `--seed` CLI option.
53
+ # Setting this allows you to use `--seed` to deterministically reproduce
54
+ # test failures related to randomization by passing the same `--seed` value
55
+ # as the one that triggered the failure.
56
+ Kernel.srand config.seed
57
+
58
+ # rspec-expectations config goes here. You can use an alternate
59
+ # assertion/expectation library such as wrong or the stdlib/minitest
60
+ # assertions if you prefer.
61
+ config.expect_with :rspec do |expectations|
62
+ # Enable only the newer, non-monkey-patching expect syntax.
63
+ # For more details, see:
64
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
65
+ expectations.syntax = :expect
66
+ end
67
+
68
+ # rspec-mocks config goes here. You can use an alternate test double
69
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
70
+ config.mock_with :rspec do |mocks|
71
+ # Enable only the newer, non-monkey-patching expect syntax.
72
+ # For more details, see:
73
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
74
+ mocks.syntax = :expect
75
+
76
+ # Prevents you from mocking or stubbing a method that does not exist on
77
+ # a real object. This is generally recommended.
78
+ mocks.verify_partial_doubles = true
79
+ end
80
+ =end
81
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: growl-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - dpree
@@ -14,16 +14,16 @@ dependencies:
14
14
  name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '3.0'
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: '0'
26
+ version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: growl
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -46,15 +46,22 @@ extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
48
  - .gitignore
49
+ - .rspec
49
50
  - Gemfile
50
51
  - MIT-LICENSE
51
52
  - README.md
52
53
  - Rakefile
54
+ - examples/.rspec
55
+ - examples/Gemfile
56
+ - examples/spec/example_spec.rb
57
+ - examples/spec/spec_helper.rb
53
58
  - growl-rspec.gemspec
54
59
  - lib/growl-rspec.rb
55
60
  - lib/growl/rspec.rb
56
61
  - lib/growl/rspec/formatter.rb
57
62
  - lib/growl/rspec/version.rb
63
+ - spec/lib/growl/rspec/formatter_spec.rb
64
+ - spec/spec_helper.rb
58
65
  homepage: https://github.com/dpree/growl-rspec
59
66
  licenses: []
60
67
  metadata: {}
@@ -78,4 +85,6 @@ rubygems_version: 2.0.3
78
85
  signing_key:
79
86
  specification_version: 4
80
87
  summary: Publishing RSpec results via Growl
81
- test_files: []
88
+ test_files:
89
+ - spec/lib/growl/rspec/formatter_spec.rb
90
+ - spec/spec_helper.rb