guard-rspec 4.2.7 → 4.2.8

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzdhYWQ0ZjRhNWRhMGY2NWEwODMyZjA4OWVlNDkzMzQyMWNiOTJmNw==
4
+ YWMzMjU3M2I0YjA0Zjk3YWE2ZjVkYTRjODY3ODE0NzYyZGM2NmY1ZQ==
5
5
  data.tar.gz: !binary |-
6
- ZGIzOGM0ODQ1YjNkNDA1NzczNjAwNDNiYTUzN2M2OTkwNmU5ZmMxYQ==
6
+ MGVlZjE4MGQ3ZjA5MmQyM2M1NDU4YWYwYTc4OTc3NWMyODQzYmExMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDMzYjQ3OTI0OWU0ODk0OGIyYmJmZTdjZDNhZjkwMDBmNGUxZmI4M2NmNDli
10
- ZTBiOTAyOTAzMjE1OWJjNGVjOWYyODhkMzQ3YTQwOTRmYzRlZmY2YjFiZDIw
11
- ZTM3NDcxMTllMjUwNWRiNTMzMmUyY2VmMjNjMzgwMDI4YTVhZjk=
9
+ MGYyMDI5NTY4ZjA2MjIzMWFkZGJhNzRjM2MxMWEwNGI0MzA4N2Y0Zjk2NGM0
10
+ YTJlNWM4NDk4Mjg0NTI4MjBlYWJmYWJlMGJmNGI1MGJiZDgxOWNlNzIwYjlj
11
+ ZGFhNmM2ZDQ0NmY1NzAwMTMyZmU4Mjc5OGQ2ZmE5NTMyYTc0ZWU=
12
12
  data.tar.gz: !binary |-
13
- M2M5YTcxMTQ5OTNkNWVhOGUwZjc5ZTE5NmFkZTdlMTY2MTVlMGFmOGUwMzA2
14
- NmRiYTEwNmZhZTZlYmUyOGRiODg4MWQwMjM0Y2NkYjk1MTNiNTYwNDYwNGM4
15
- ZDYzZTI1ZmNhNzVjODNkZjhlMTFlODRlNDY3Nzg3ZWYzNTc2MjM=
13
+ NjcyNGE3M2FlZGFkYmMyYmZhY2I5MjE3YTZhZTE1NWU4ZWIzYjNkYmQxZDY0
14
+ ZmJlOTUyZDYwOWMxMTZjZjY1YWM5MzUxYTExY2Y0MjliMDBkMzRhZjA1MmMy
15
+ OWU0MjM3Y2Q5MDA2OWFlZmU2ODc0NThlZTk2YzE3M2JiMDMxMmI=
@@ -6,6 +6,14 @@ module Guard
6
6
  class Formatter < ::RSpec::Core::Formatters::BaseFormatter
7
7
  TEMPORARY_FILE_PATH = File.expand_path('./tmp/rspec_guard_result')
8
8
 
9
+ def self.rspec_3?
10
+ ::RSpec::Core::Version::STRING.split('.').first == "3"
11
+ end
12
+
13
+ if rspec_3?
14
+ ::RSpec::Core::Formatters.register self, :dump_summary
15
+ end
16
+
9
17
  # rspec issue https://github.com/rspec/rspec-core/issues/793
10
18
  def self.extract_spec_location(metadata)
11
19
  root_metadata = metadata
@@ -35,7 +43,17 @@ module Guard
35
43
  end
36
44
 
37
45
  # Write summary to temporary file for runner
38
- def dump_summary(duration, total, failures, pending)
46
+ def dump_summary(*args)
47
+ if self.class.rspec_3?
48
+ notification = args[0]
49
+ duration = notification.duration
50
+ total = notification.example_count
51
+ failures = notification.failure_count
52
+ pending = notification.pending_count
53
+ else
54
+ duration, total, failures, pending = args
55
+ end
56
+
39
57
  write do |f|
40
58
  f.puts _message(total, failures, pending, duration)
41
59
  f.puts _failed_paths.join("\n") if failures > 0
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module RSpecVersion
3
- VERSION = '4.2.7'
3
+ VERSION = '4.2.8'
4
4
  end
5
5
  end
@@ -60,6 +60,20 @@ describe Guard::RSpec::Formatter do
60
60
  expect(result).to match /^3 examples, 1 failures in 123\.0 seconds\n#{spec_filename}\n$/
61
61
  end
62
62
 
63
+ context "for rspec 3" do
64
+ let(:notification) {
65
+ Struct.new(:duration, :example_count, :failure_count, :pending_count).new(123, 3, 1, 0)
66
+ }
67
+ before do
68
+ formatter.class.stub(:rspec_3?).and_return(true)
69
+ end
70
+
71
+ it 'writes summary line and failed location' do
72
+ allow(formatter).to receive(:examples) { [failed_example] }
73
+ formatter.dump_summary(notification)
74
+ expect(result).to match /^3 examples, 1 failures in 123\.0 seconds\n#{spec_filename}\n$/
75
+ end
76
+ end
63
77
  end
64
78
 
65
79
  it 'should find the spec file for shared examples' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.7
4
+ version: 4.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibaud Guillaume-Gentil
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-22 00:00:00.000000000 Z
11
+ date: 2014-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard