guard-rspec 4.6.4 → 4.6.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 +4 -4
- data/.hound.yml +0 -3
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/guard-rspec.gemspec +2 -2
- data/lib/guard/rspec.rb +1 -1
- data/lib/guard/rspec/deprecator.rb +2 -2
- data/lib/guard/rspec/dsl.rb +1 -1
- data/lib/guard/rspec/inspectors/focused_inspector.rb +2 -2
- data/lib/guard/rspec/options.rb +2 -2
- data/lib/guard/rspec/rspec_process.rb +0 -2
- data/lib/guard/rspec/runner.rb +1 -1
- data/lib/guard/rspec/version.rb +1 -1
- data/lib/guard/rspec_defaults.rb +1 -1
- data/lib/guard/rspec_formatter.rb +50 -32
- data/spec/lib/guard/rspec/deprecator_spec.rb +2 -2
- data/spec/lib/guard/rspec/inspectors/keeping_inspector_spec.rb +21 -13
- data/spec/lib/guard/rspec/notifier_spec.rb +3 -3
- data/spec/lib/guard/rspec/results_spec.rb +1 -1
- data/spec/lib/guard/rspec/runner_spec.rb +6 -4
- data/spec/lib/guard/rspec_formatter_spec.rb +19 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36f680214b513178f42ad7f47d9fa8f6059eb5df
|
4
|
+
data.tar.gz: 9ed784b1fe3be511dfaec7d934cc88b2c7d674bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebe1c445d9b2b52cb5f5b50d92d4d7bc8611034c95972dd79e1b29cd85a9e85a0ae9649c1e1eee4d820266306c1dabb8ba8fec42c83d4bd7d76ef4cdc6b7790d
|
7
|
+
data.tar.gz: 9d758975348f80fa7dafcd71aeed1cdbdfd49dd32a82ab7ec60576f51da23600112dae3ac8c8edffb3a4ece91a1396c6ba74a49fcaaa81e152ad7a0f7c1bbbcf
|
data/.hound.yml
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
Guard::RSpec allows to automatically & intelligently launch specs when files are modified.
|
6
6
|
|
7
7
|
* Compatible with RSpec >2.14 & 3
|
8
|
-
* Tested against Ruby
|
8
|
+
* Tested against Ruby 2.2.x, JRuby and Rubinius.
|
9
9
|
|
10
10
|
## Install
|
11
11
|
|
data/guard-rspec.gemspec
CHANGED
@@ -10,9 +10,9 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.email = "thibaud@thibaud.gg"
|
11
11
|
s.summary = "Guard gem for RSpec"
|
12
12
|
s.description = "Guard::RSpec automatically run your specs" +
|
13
|
-
|
13
|
+
" (much like autotest)."
|
14
14
|
|
15
|
-
s.homepage = "https://
|
15
|
+
s.homepage = "https://github.com/guard/guard-rspec"
|
16
16
|
s.license = "MIT"
|
17
17
|
|
18
18
|
s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
data/lib/guard/rspec.rb
CHANGED
@@ -71,8 +71,8 @@ module Guard
|
|
71
71
|
return unless options.key?(:focus_on_failed)
|
72
72
|
_deprecated(
|
73
73
|
"The :focus_on_failed option is deprecated." +
|
74
|
-
"
|
75
|
-
" :
|
74
|
+
" Please set new :failed_mode option value to" +
|
75
|
+
" :focus instead." +
|
76
76
|
" https://github.com/guard/guard-rspec#list-of-available-options")
|
77
77
|
end
|
78
78
|
|
data/lib/guard/rspec/dsl.rb
CHANGED
data/lib/guard/rspec/options.rb
CHANGED
@@ -5,14 +5,14 @@ module Guard
|
|
5
5
|
all_on_start: false,
|
6
6
|
all_after_pass: false,
|
7
7
|
run_all: { message: "Running all specs" },
|
8
|
-
failed_mode: :none,
|
8
|
+
failed_mode: :none, # :keep and :focus are other posibilities
|
9
9
|
spec_paths: %w(spec),
|
10
10
|
cmd: nil,
|
11
11
|
cmd_additional_args: nil,
|
12
12
|
launchy: nil,
|
13
13
|
notification: true,
|
14
14
|
title: "RSpec results"
|
15
|
-
}
|
15
|
+
}.freeze
|
16
16
|
|
17
17
|
class << self
|
18
18
|
def with_defaults(options = {})
|
data/lib/guard/rspec/runner.rb
CHANGED
data/lib/guard/rspec/version.rb
CHANGED
data/lib/guard/rspec_defaults.rb
CHANGED
@@ -7,18 +7,22 @@ require "fileutils"
|
|
7
7
|
require "rspec"
|
8
8
|
require "rspec/core/formatters/base_formatter"
|
9
9
|
|
10
|
-
|
10
|
+
require_relative "rspec_defaults"
|
11
11
|
|
12
12
|
module Guard
|
13
13
|
class RSpecFormatter < ::RSpec::Core::Formatters::BaseFormatter
|
14
14
|
WIKI_ENV_WARN_URL =
|
15
|
-
"https://github.com/guard/guard-rspec/wiki/Warning:-no-environment"
|
15
|
+
"https://github.com/guard/guard-rspec/wiki/Warning:-no-environment".freeze
|
16
16
|
|
17
|
-
NO_ENV_WARNING_MSG =
|
18
|
-
|
17
|
+
NO_ENV_WARNING_MSG =
|
18
|
+
"no environment passed - see #{WIKI_ENV_WARN_URL}".freeze
|
19
19
|
|
20
|
-
|
21
|
-
"
|
20
|
+
NO_RESULTS_VALUE_MSG =
|
21
|
+
":results_file value unknown (using defaults)".freeze
|
22
|
+
|
23
|
+
UNSUPPORTED_PATTERN =
|
24
|
+
"Your RSpec.configuration.pattern uses characters "\
|
25
|
+
"unsupported by your Ruby version (File::FNM_EXTGLOB is undefined)".freeze
|
22
26
|
|
23
27
|
class Error < RuntimeError
|
24
28
|
class UnsupportedPattern < Error
|
@@ -44,40 +48,54 @@ module Guard
|
|
44
48
|
end
|
45
49
|
end
|
46
50
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
+
class << self
|
52
|
+
# rspec issue https://github.com/rspec/rspec-core/issues/793
|
53
|
+
def extract_spec_location(metadata)
|
54
|
+
root_metadata = metadata
|
55
|
+
location = metadata[:location]
|
56
|
+
|
57
|
+
until spec_path?(location)
|
58
|
+
metadata = metadata[:parent_example_group] || metadata[:example_group]
|
51
59
|
|
52
|
-
|
53
|
-
|
60
|
+
unless metadata
|
61
|
+
STDERR.puts "no spec file location in #{root_metadata.inspect}"
|
62
|
+
return root_metadata[:location]
|
63
|
+
end
|
54
64
|
|
55
|
-
|
56
|
-
|
57
|
-
return root_metadata[:location]
|
65
|
+
# rspec issue https://github.com/rspec/rspec-core/issues/1243
|
66
|
+
location = first_colon_separated_entry(metadata[:location])
|
58
67
|
end
|
59
68
|
|
60
|
-
|
61
|
-
location = (metadata[:location] || "").split(":").first
|
69
|
+
location
|
62
70
|
end
|
63
71
|
|
64
|
-
|
65
|
-
|
72
|
+
def spec_path?(path)
|
73
|
+
pattern = ::RSpec.configuration.pattern
|
74
|
+
|
75
|
+
flags = supported_fnmatch_flags(pattern)
|
76
|
+
path ||= ""
|
77
|
+
path = path.sub(/:\d+\z/, "")
|
78
|
+
path = Pathname.new(path).cleanpath.to_s
|
79
|
+
stripped = "{#{pattern.gsub(/\s*,\s*/, ',')}}"
|
80
|
+
File.fnmatch(stripped, path, flags)
|
81
|
+
end
|
66
82
|
|
67
|
-
|
68
|
-
pattern = ::RSpec.configuration.pattern
|
83
|
+
private
|
69
84
|
|
70
|
-
|
71
|
-
|
72
|
-
flags |= File::FNM_EXTGLOB
|
73
|
-
elsif pattern =~ /[{}]/
|
74
|
-
fail Error::UnsupportedPattern
|
85
|
+
def first_colon_separated_entry(entries)
|
86
|
+
(entries || "").split(":").first
|
75
87
|
end
|
76
88
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
89
|
+
def supported_fnmatch_flags(pattern)
|
90
|
+
flags = File::FNM_PATHNAME | File::FNM_DOTMATCH
|
91
|
+
|
92
|
+
# ruby >= 2
|
93
|
+
return flags |= File::FNM_EXTGLOB if File.const_defined?(:FNM_EXTGLOB)
|
94
|
+
|
95
|
+
fail Error::UnsupportedPattern if pattern =~ /[{}]/
|
96
|
+
|
97
|
+
flags
|
98
|
+
end
|
81
99
|
end
|
82
100
|
|
83
101
|
def dump_summary(*args)
|
@@ -134,8 +152,8 @@ module Guard
|
|
134
152
|
def _results_file
|
135
153
|
path = ENV["GUARD_RSPEC_RESULTS_FILE"]
|
136
154
|
if path.nil?
|
137
|
-
STDERR.puts
|
138
|
-
|
155
|
+
STDERR.puts("Guard::RSpec: Warning: #{NO_ENV_WARNING_MSG}\n" \
|
156
|
+
"Guard::RSpec: Warning: #{NO_RESULTS_VALUE_MSG}")
|
139
157
|
path = RSpecDefaults::TEMPORARY_FILE_PATH
|
140
158
|
end
|
141
159
|
|
@@ -84,8 +84,8 @@ RSpec.describe Guard::RSpec::Deprecator do
|
|
84
84
|
expect(Guard::Compat::UI).to receive(:warning).with(
|
85
85
|
"Guard::RSpec DEPRECATION WARNING:" +
|
86
86
|
" The :focus_on_failed option is deprecated." +
|
87
|
-
"
|
88
|
-
" :
|
87
|
+
" Please set new :failed_mode option value to" +
|
88
|
+
" :focus instead." +
|
89
89
|
" https://github.com/guard/guard-rspec#list-of-available-options")
|
90
90
|
deprecator.warns_about_deprecated_options
|
91
91
|
end
|
@@ -58,11 +58,13 @@ RSpec.describe klass do
|
|
58
58
|
|
59
59
|
# Line numbers in failed_locations needs to be omitted because of
|
60
60
|
# https://github.com/rspec/rspec-core/issues/952
|
61
|
-
expect(inspector.paths(other_paths)).to match_array(
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
61
|
+
expect(inspector.paths(other_paths)).to match_array(
|
62
|
+
[
|
63
|
+
"spec/lib/guard/rspec/deprecator_spec.rb",
|
64
|
+
"spec/lib/guard/rspec/runner_spec.rb",
|
65
|
+
"spec/lib/guard/rspec/inspectors/simple_inspector_spec.rb"
|
66
|
+
]
|
67
|
+
)
|
66
68
|
inspector.failed(other_failed_locations)
|
67
69
|
|
68
70
|
# Now it returns other failed locations
|
@@ -70,18 +72,24 @@ RSpec.describe klass do
|
|
70
72
|
inspector.paths(
|
71
73
|
%w(spec/lib/guard/rspec/inspectors/base_inspector_spec.rb)
|
72
74
|
)
|
73
|
-
).to match_array(
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
).to match_array(
|
76
|
+
[
|
77
|
+
"spec/lib/guard/rspec/runner_spec.rb",
|
78
|
+
"spec/lib/guard/rspec/inspectors/simple_inspector_spec.rb",
|
79
|
+
"spec/lib/guard/rspec/inspectors/base_inspector_spec.rb"
|
80
|
+
]
|
81
|
+
)
|
78
82
|
inspector.failed(other_failed_locations)
|
79
83
|
|
80
|
-
expect(
|
81
|
-
|
84
|
+
expect(
|
85
|
+
inspector.paths(%w(spec/lib/guard/rspec/runner_spec.rb))
|
86
|
+
).to match_array(
|
87
|
+
[
|
82
88
|
"spec/lib/guard/rspec/runner_spec.rb",
|
83
89
|
"spec/lib/guard/rspec/inspectors/simple_inspector_spec.rb"
|
84
|
-
]
|
90
|
+
]
|
91
|
+
)
|
92
|
+
|
85
93
|
inspector.failed([])
|
86
94
|
|
87
95
|
# Now there is no failed locations
|
@@ -6,7 +6,7 @@ RSpec.describe Guard::RSpec::Notifier do
|
|
6
6
|
let(:options) { { notification: true, title: "RSpec results" } }
|
7
7
|
let(:notifier) { Guard::RSpec::Notifier.new(options) }
|
8
8
|
|
9
|
-
def expect_notification(title = "RSpec results"
|
9
|
+
def expect_notification(message, image, priority, title = "RSpec results")
|
10
10
|
expect(Guard::Compat::UI).to receive(:notify).
|
11
11
|
with(message, title: title, image: image, priority: priority)
|
12
12
|
end
|
@@ -21,7 +21,7 @@ RSpec.describe Guard::RSpec::Notifier do
|
|
21
21
|
let(:options) { { notification: true, title: "Failure title" } }
|
22
22
|
|
23
23
|
it "notifies with the title" do
|
24
|
-
expect_notification("
|
24
|
+
expect_notification("Failed", :failed, 2, "Failure title")
|
25
25
|
notifier.notify_failure
|
26
26
|
end
|
27
27
|
end
|
@@ -64,7 +64,7 @@ RSpec.describe Guard::RSpec::Notifier do
|
|
64
64
|
let(:options) { { notification: true, title: "Custom title" } }
|
65
65
|
|
66
66
|
it "notifies with the title" do
|
67
|
-
expect_notification("
|
67
|
+
expect_notification("This is summary", :success, -2, "Custom title")
|
68
68
|
notifier.notify("This is summary")
|
69
69
|
end
|
70
70
|
end
|
@@ -272,10 +272,12 @@ RSpec.describe Guard::RSpec::Runner do
|
|
272
272
|
|
273
273
|
context "with failed paths" do
|
274
274
|
before do
|
275
|
-
allow(results).to receive(:failed_paths).and_return(
|
276
|
-
|
277
|
-
|
278
|
-
|
275
|
+
allow(results).to receive(:failed_paths).and_return(
|
276
|
+
[
|
277
|
+
"./failed_spec.rb:123",
|
278
|
+
"./other/failed_spec.rb:77"
|
279
|
+
]
|
280
|
+
)
|
279
281
|
end
|
280
282
|
|
281
283
|
it "notifies inspector about failed paths" do
|
@@ -50,7 +50,8 @@ RSpec.describe Guard::RSpecFormatter do
|
|
50
50
|
|
51
51
|
around do |example|
|
52
52
|
env_var = "GUARD_RSPEC_RESULTS_FILE"
|
53
|
-
old
|
53
|
+
old = ENV[env_var]
|
54
|
+
ENV[env_var] = "foobar.txt"
|
54
55
|
example.run
|
55
56
|
ENV[env_var] = old
|
56
57
|
end
|
@@ -254,5 +255,22 @@ RSpec.describe Guard::RSpecFormatter do
|
|
254
255
|
end
|
255
256
|
end
|
256
257
|
end
|
258
|
+
|
259
|
+
context "when RSpec 3.0 is configured to use multiple patterns" do
|
260
|
+
before do
|
261
|
+
allow(::RSpec.configuration).to receive(:pattern).
|
262
|
+
and_return("**{,/*/**}/*_spec.rb,**/*.feature")
|
263
|
+
end
|
264
|
+
|
265
|
+
it "matches a spec file with the first pattern" do
|
266
|
+
expect(described_class.spec_path?("./spec/foo_spec.rb")).
|
267
|
+
to be_truthy
|
268
|
+
end
|
269
|
+
|
270
|
+
it "matches a spec file with the second pattern" do
|
271
|
+
expect(described_class.spec_path?("./spec/acceptance/bar.feature")).
|
272
|
+
to be_truthy
|
273
|
+
end
|
274
|
+
end
|
257
275
|
end
|
258
276
|
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.6.
|
4
|
+
version: 4.6.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:
|
11
|
+
date: 2016-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|
@@ -162,7 +162,7 @@ files:
|
|
162
162
|
- spec/lib/guard/rspec_formatter_spec.rb
|
163
163
|
- spec/lib/guard/rspec_spec.rb
|
164
164
|
- spec/spec_helper.rb
|
165
|
-
homepage: https://
|
165
|
+
homepage: https://github.com/guard/guard-rspec
|
166
166
|
licenses:
|
167
167
|
- MIT
|
168
168
|
metadata: {}
|
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
182
|
version: '0'
|
183
183
|
requirements: []
|
184
184
|
rubyforge_project:
|
185
|
-
rubygems_version: 2.
|
185
|
+
rubygems_version: 2.5.1
|
186
186
|
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: Guard gem for RSpec
|