guard-rspec 4.2.4 → 4.2.5

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: 68ca1733c0e0f32c09688a1bc91d098a383c0dfc
4
- data.tar.gz: 683059e58e8673b87957cc8d81a971916e617b0b
3
+ metadata.gz: a598c45db4e4390bae3972fa52d33fac7c89198d
4
+ data.tar.gz: f83033f5b8b6fb4c93014a0b49513b03f9680f8d
5
5
  SHA512:
6
- metadata.gz: e2b2ccf857787b9a517d8ecc25c80f608c70b374aaa488f16b143945185450c828bc77c0ca9c2ffa5c98988979a5aa9c98f7f5bd00156f26dbeceb7d88f918e5
7
- data.tar.gz: 2a388ad2d0d7679fbd4eb2ccbe2748d43eb7d617167d54ccafc65483c854df51f5e38c6a5f7496a9aca2e946a29c7a84aae3008f3095943d38dfd84a6169b255
6
+ metadata.gz: 16367f9c055934e7d9a22ada928d566b26755110e03064b41f4093789b0ed2a1fb3c21e265efd39c8c3f78de1df65dbabfc9720f1584baf32acaa5e66ff6b016
7
+ data.tar.gz: dbe619c50ec3df366100f9fea1f0c513d859e93a8e7564e9bcddd4b54a2b301347885b72713e7603ec7cbe104d1d64573c507776728555d9ed34075735a26beb
@@ -4,7 +4,7 @@ require 'rspec/core/formatters/base_formatter'
4
4
  module Guard
5
5
  class RSpec
6
6
  class Formatter < ::RSpec::Core::Formatters::BaseFormatter
7
- TEMPORARY_FILE_PATH = './tmp/rspec_guard_result'
7
+ TEMPORARY_FILE_PATH = File.expand_path('./tmp/rspec_guard_result')
8
8
 
9
9
  # rspec issue https://github.com/rspec/rspec-core/issues/793
10
10
  def self.extract_spec_location(metadata)
@@ -47,7 +47,7 @@ module Guard
47
47
  private
48
48
 
49
49
  def write(&block)
50
- FileUtils.mkdir_p('tmp')
50
+ FileUtils.mkdir_p(File.dirname(TEMPORARY_FILE_PATH))
51
51
  File.open(TEMPORARY_FILE_PATH, 'w', &block)
52
52
  end
53
53
 
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module RSpecVersion
3
- VERSION = '4.2.4'
3
+ VERSION = '4.2.5'
4
4
  end
5
5
  end
@@ -1,32 +1,48 @@
1
1
  require 'spec_helper.rb'
2
-
3
2
  require 'guard/rspec/formatter'
4
3
 
5
4
  describe Guard::RSpec::Formatter do
6
- let(:writer){
7
- StringIO.new
8
- }
9
- let(:formatter) {
10
- Guard::RSpec::Formatter.new(StringIO.new).tap{|formatter|
11
- formatter.stub(:write) do |&block|
12
- block.call writer
13
- end
14
- }
15
- }
5
+ describe '::TEMPORARY_FILE_PATH' do
6
+ it 'is absolute path' do
7
+ require 'pathname'
8
+ temporary_file_path = described_class.const_get(:TEMPORARY_FILE_PATH)
9
+ expect(Pathname.new(temporary_file_path).absolute?).to be_true
10
+ end
11
+ end
16
12
 
17
13
  describe '#dump_summary' do
18
-
19
- let(:result){
14
+ let(:writer) {
15
+ StringIO.new
16
+ }
17
+ let(:formatter) {
18
+ Guard::RSpec::Formatter.new(StringIO.new).tap do |formatter|
19
+ formatter.stub(:write) do |&block|
20
+ block.call writer
21
+ end
22
+ end
23
+ }
24
+ let(:result) {
20
25
  writer.rewind
21
26
  writer.read
22
27
  }
23
28
 
29
+ context 'without stubbed IO' do
30
+ let(:formatter) {
31
+ Guard::RSpec::Formatter.new(StringIO.new)
32
+ }
33
+
34
+ it 'creates temporary file and and writes to it' do
35
+ temporary_file_path = described_class.const_get(:TEMPORARY_FILE_PATH)
36
+ expect(FileUtils).to receive(:mkdir_p).with(File.dirname(temporary_file_path)) {}
37
+ expect(File).to receive(:open).with(temporary_file_path, 'w') { |filename, mode, &block| block.call writer }
38
+ formatter.dump_summary(123, 1, 2, 3)
39
+ end
40
+ end
24
41
 
25
42
  context 'with failures' do
26
- let(:spec_filename){
43
+ let(:spec_filename) {
27
44
  'failed_location_spec.rb'
28
45
  }
29
-
30
46
  let(:failed_example) { double(
31
47
  execution_result: { status: 'failed' },
32
48
  metadata: { location: spec_filename }
@@ -46,27 +62,32 @@ describe Guard::RSpec::Formatter do
46
62
 
47
63
  end
48
64
 
49
- it "should find the spec file for shared examples" do
50
- metadata = {:location => './spec/support/breadcrumbs.rb:75',
51
- :example_group => {:location => './spec/requests/breadcrumbs_spec.rb:218'}
52
- }
65
+ it 'should find the spec file for shared examples' do
66
+ metadata = {
67
+ location: './spec/support/breadcrumbs.rb:75',
68
+ example_group: { location: './spec/requests/breadcrumbs_spec.rb:218' }
69
+ }
53
70
 
54
71
  expect(described_class.extract_spec_location(metadata)).to start_with './spec/requests/breadcrumbs_spec.rb'
55
72
  end
56
73
 
57
- it "should return only the spec file without line number for shared examples" do
58
- metadata = {:location => './spec/support/breadcrumbs.rb:75',
59
- :example_group => {:location => './spec/requests/breadcrumbs_spec.rb:218'}
74
+ # Skip location because of rspec issue https://github.com/rspec/rspec-core/issues/1243
75
+ it 'should return only the spec file without line number for shared examples' do
76
+ metadata = {
77
+ location: './spec/support/breadcrumbs.rb:75',
78
+ example_group: { location: './spec/requests/breadcrumbs_spec.rb:218' }
60
79
  }
61
80
 
62
81
  expect(described_class.extract_spec_location(metadata)).to eq './spec/requests/breadcrumbs_spec.rb'
63
82
  end
64
83
 
65
- it "should return location of the root spec when a shared examples has no location" do
66
- metadata = {:location => './spec/support/breadcrumbs.rb:75',
67
- :example_group => {}
84
+ it 'should return location of the root spec when a shared examples has no location' do
85
+ metadata = {
86
+ location: './spec/support/breadcrumbs.rb:75',
87
+ example_group: {}
68
88
  }
69
89
 
90
+ expect(Guard::UI).to receive(:warning).with("no spec file found for #{metadata[:location]}") {}
70
91
  expect(described_class.extract_spec_location(metadata)).to eq metadata[:location]
71
92
  end
72
93
 
@@ -84,5 +105,4 @@ describe Guard::RSpec::Formatter do
84
105
  end
85
106
  end
86
107
  end
87
-
88
108
  end
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.4
4
+ version: 4.2.5
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-01-09 00:00:00.000000000 Z
11
+ date: 2014-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard