guard-rspec 4.2.4 → 4.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/guard/rspec/formatter.rb +2 -2
- data/lib/guard/rspec/version.rb +1 -1
- data/spec/lib/guard/rspec/formatter_spec.rb +46 -26
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a598c45db4e4390bae3972fa52d33fac7c89198d
|
4
|
+
data.tar.gz: f83033f5b8b6fb4c93014a0b49513b03f9680f8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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(
|
50
|
+
FileUtils.mkdir_p(File.dirname(TEMPORARY_FILE_PATH))
|
51
51
|
File.open(TEMPORARY_FILE_PATH, 'w', &block)
|
52
52
|
end
|
53
53
|
|
data/lib/guard/rspec/version.rb
CHANGED
@@ -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
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
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
|
50
|
-
metadata = {
|
51
|
-
|
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
|
-
|
58
|
-
|
59
|
-
|
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
|
66
|
-
metadata = {
|
67
|
-
|
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
|
+
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-
|
11
|
+
date: 2014-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|