guard-rspec 4.6.5 → 4.7.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 +4 -4
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +36 -2
- data/.travis.yml +6 -5
- data/Gemfile +1 -1
- data/Guardfile +3 -3
- data/README.md +4 -2
- data/gemfiles/{Gemfile.rspec-2.14 → Gemfile.rspec-3.4} +1 -1
- data/guard-rspec.gemspec +1 -1
- data/lib/guard/rspec/command.rb +2 -1
- data/lib/guard/rspec/deprecator.rb +15 -13
- data/lib/guard/rspec/dsl.rb +12 -10
- data/lib/guard/rspec/inspectors/base_inspector.rb +3 -3
- data/lib/guard/rspec/inspectors/keeping_inspector.rb +1 -1
- data/lib/guard/rspec/notifier.rb +1 -2
- data/lib/guard/rspec/results.rb +1 -1
- data/lib/guard/rspec/rspec_process.rb +27 -2
- data/lib/guard/rspec/runner.rb +14 -11
- data/lib/guard/rspec/templates/Guardfile +5 -5
- data/lib/guard/rspec/version.rb +1 -1
- data/lib/guard/rspec_formatter.rb +15 -29
- data/lib/guard/rspec_formatter_results_path.rb +29 -0
- data/spec/lib/guard/rspec/command_spec.rb +9 -9
- data/spec/lib/guard/rspec/deprecator_spec.rb +31 -24
- data/spec/lib/guard/rspec/results_spec.rb +4 -2
- data/spec/lib/guard/rspec/rspec_process_spec.rb +45 -2
- data/spec/lib/guard/rspec/runner_spec.rb +53 -16
- data/spec/lib/guard/rspec_formatter_spec.rb +3 -2
- data/spec/spec_helper.rb +9 -9
- metadata +5 -6
- data/.hound.yml +0 -259
- data/gemfiles/Gemfile.rspec-3.3 +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fc28c16ceeddadc68019093ed5e2d48362f5c3c
|
4
|
+
data.tar.gz: 3b52eda168c7398bca052b5c01497b97dd2d11bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2770e272f1965dd1cce1878f5dcb9617dff9519c453f6806fa8c7945603476edfe5cf33289a4d95267f154eb15cee8ba10459263b00ca987436e94c16909736
|
7
|
+
data.tar.gz: 293ed7b6f57587da0b3b4df12a8b0520b0d33b2fe16b17c8222ceb09c458dae57de5a7b8da95d74d65b69e16fc8be3452adc01055ebc3bcf65bf4acbb3c70aee
|
data/.rubocop.yml
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
inherit_from:
|
2
|
-
.
|
2
|
+
.rubocop_todo.yml
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,40 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
#
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2016-05-22 06:08:35 +0200 using RuboCop version 0.40.0.
|
3
4
|
# The point is for the user to remove these configuration records
|
4
5
|
# one by one as the offenses are removed from the code base.
|
5
6
|
# Note that changes in the inspected code, or installation of new
|
6
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 15
|
10
|
+
Style/Documentation:
|
11
|
+
Exclude:
|
12
|
+
- 'spec/**/*'
|
13
|
+
- 'test/**/*'
|
14
|
+
- 'lib/guard/rspec.rb'
|
15
|
+
- 'lib/guard/rspec/command.rb'
|
16
|
+
- 'lib/guard/rspec/deprecator.rb'
|
17
|
+
- 'lib/guard/rspec/dsl.rb'
|
18
|
+
- 'lib/guard/rspec/inspectors/base_inspector.rb'
|
19
|
+
- 'lib/guard/rspec/inspectors/factory.rb'
|
20
|
+
- 'lib/guard/rspec/inspectors/simple_inspector.rb'
|
21
|
+
- 'lib/guard/rspec/notifier.rb'
|
22
|
+
- 'lib/guard/rspec/options.rb'
|
23
|
+
- 'lib/guard/rspec/results.rb'
|
24
|
+
- 'lib/guard/rspec/rspec_process.rb'
|
25
|
+
- 'lib/guard/rspec/runner.rb'
|
26
|
+
- 'lib/guard/rspec_formatter.rb'
|
27
|
+
|
28
|
+
# Offense count: 148
|
29
|
+
# Cop supports --auto-correct.
|
30
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
31
|
+
# SupportedStyles: leading, trailing
|
32
|
+
Style/DotPosition:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
# Offense count: 654
|
36
|
+
# Cop supports --auto-correct.
|
37
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
|
38
|
+
# SupportedStyles: single_quotes, double_quotes
|
39
|
+
Style/StringLiterals:
|
40
|
+
Enabled: false
|
data/.travis.yml
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
language: ruby
|
2
2
|
bundler_args: --without tool
|
3
3
|
rvm:
|
4
|
-
- 2.2.
|
5
|
-
-
|
4
|
+
- 2.2.5
|
5
|
+
- 2.3.1
|
6
|
+
- jruby-9.0.5.0
|
6
7
|
gemfile:
|
7
|
-
- gemfiles/Gemfile.rspec-2.14
|
8
8
|
- gemfiles/Gemfile.rspec-2.99
|
9
|
-
- gemfiles/Gemfile.rspec-3.
|
9
|
+
- gemfiles/Gemfile.rspec-3.4
|
10
10
|
matrix:
|
11
11
|
allow_failures:
|
12
|
-
- rvm: jruby-
|
12
|
+
- rvm: jruby-9.0.50
|
13
13
|
sudo: false
|
14
|
+
cache: bundler
|
data/Gemfile
CHANGED
data/Guardfile
CHANGED
@@ -13,16 +13,16 @@ group :specs, halt_on_fail: true do
|
|
13
13
|
dsl.watch_spec_files_for(dsl.ruby.lib_files)
|
14
14
|
|
15
15
|
watch(%r{^(lib/guard/rspec/template)s/Guardfile$}) do
|
16
|
-
rspec.spec.("lib/guard/rspec/template")
|
16
|
+
rspec.spec.call("lib/guard/rspec/template")
|
17
17
|
end
|
18
18
|
|
19
19
|
watch(%r{^lib/guard/rspec/dsl.rb$}) do
|
20
|
-
rspec.spec.("lib/guard/rspec/template")
|
20
|
+
rspec.spec.call("lib/guard/rspec/template")
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
guard :rubocop, all_on_start: false do
|
25
|
-
watch(
|
25
|
+
watch(/.+\.rb$/)
|
26
26
|
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
27
27
|
end
|
28
28
|
end
|
data/README.md
CHANGED
@@ -4,8 +4,8 @@
|
|
4
4
|
|
5
5
|
Guard::RSpec allows to automatically & intelligently launch specs when files are modified.
|
6
6
|
|
7
|
-
* Compatible with RSpec >2.
|
8
|
-
* Tested against Ruby 2.2.x, JRuby and Rubinius
|
7
|
+
* Compatible with RSpec >2.99 & 3
|
8
|
+
* Tested against Ruby 2.2.x, JRuby 9.0.5.0 ~~and Rubinius~~.
|
9
9
|
|
10
10
|
## Install
|
11
11
|
|
@@ -66,6 +66,8 @@ guard :rspec, cmd: 'spring rspec -f doc' do
|
|
66
66
|
end
|
67
67
|
```
|
68
68
|
|
69
|
+
NOTE: the above example assumes you have the `spring rspec` command installed - see here: https://github.com/jonleighton/spring-commands-rspec
|
70
|
+
|
69
71
|
### Running with bundler
|
70
72
|
|
71
73
|
Running `bundle exec guard` will not run the specs with bundler. You need to change the `cmd` option to `bundle exec rspec`:
|
data/guard-rspec.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.author = "Thibaud Guillaume-Gentil"
|
10
10
|
s.email = "thibaud@thibaud.gg"
|
11
11
|
s.summary = "Guard gem for RSpec"
|
12
|
-
s.description = "Guard::RSpec automatically run your specs"
|
12
|
+
s.description = "Guard::RSpec automatically run your specs" \
|
13
13
|
" (much like autotest)."
|
14
14
|
|
15
15
|
s.homepage = "https://github.com/guard/guard-rspec"
|
data/lib/guard/rspec/command.rb
CHANGED
@@ -25,7 +25,7 @@ module Guard
|
|
25
25
|
def _spec_opts_env
|
26
26
|
return if ENV["SPEC_OPTS"].nil?
|
27
27
|
Compat::UI.warning(
|
28
|
-
"The SPEC_OPTS environment variable is present."
|
28
|
+
"The SPEC_OPTS environment variable is present." \
|
29
29
|
" This can conflict with guard-rspec."
|
30
30
|
)
|
31
31
|
end
|
@@ -33,7 +33,7 @@ module Guard
|
|
33
33
|
def _version_option
|
34
34
|
return unless options.key?(:version)
|
35
35
|
_deprecated(
|
36
|
-
"The :version option is deprecated."
|
36
|
+
"The :version option is deprecated." \
|
37
37
|
" Only RSpec ~> 2.14 is now supported."
|
38
38
|
)
|
39
39
|
end
|
@@ -41,8 +41,8 @@ module Guard
|
|
41
41
|
def _exclude_option
|
42
42
|
return unless options.key?(:exclude)
|
43
43
|
_deprecated(
|
44
|
-
"The :exclude option is deprecated."
|
45
|
-
" Please Guard ignore method instead."
|
44
|
+
"The :exclude option is deprecated." \
|
45
|
+
" Please Guard ignore method instead." \
|
46
46
|
" https://github.com/guard/guard#ignore"
|
47
47
|
)
|
48
48
|
end
|
@@ -52,7 +52,7 @@ module Guard
|
|
52
52
|
binstubs rvm cli spring turnip zeus foreman).each do |option|
|
53
53
|
next unless options.key?(option.to_sym)
|
54
54
|
_deprecated(
|
55
|
-
"The :#{option} option is deprecated."
|
55
|
+
"The :#{option} option is deprecated." \
|
56
56
|
" Please customize the new :cmd option to fit your need."
|
57
57
|
)
|
58
58
|
end
|
@@ -61,19 +61,21 @@ module Guard
|
|
61
61
|
def _keep_failed_option
|
62
62
|
return unless options.key?(:keep_failed)
|
63
63
|
_deprecated(
|
64
|
-
"The :keep_failed option is deprecated."
|
65
|
-
" Please set new :failed_mode option value to"
|
66
|
-
" :keep instead."
|
67
|
-
" https://github.com/guard/guard-rspec#list-of-available-options"
|
64
|
+
"The :keep_failed option is deprecated." \
|
65
|
+
" Please set new :failed_mode option value to" \
|
66
|
+
" :keep instead." \
|
67
|
+
" https://github.com/guard/guard-rspec#list-of-available-options"
|
68
|
+
)
|
68
69
|
end
|
69
70
|
|
70
71
|
def _focus_on_failed_option
|
71
72
|
return unless options.key?(:focus_on_failed)
|
72
73
|
_deprecated(
|
73
|
-
"The :focus_on_failed option is deprecated."
|
74
|
-
" Please set new :failed_mode option value to"
|
75
|
-
" :focus instead."
|
76
|
-
" https://github.com/guard/guard-rspec#list-of-available-options"
|
74
|
+
"The :focus_on_failed option is deprecated." \
|
75
|
+
" Please set new :failed_mode option value to" \
|
76
|
+
" :focus instead." \
|
77
|
+
" https://github.com/guard/guard-rspec#list-of-available-options"
|
78
|
+
)
|
77
79
|
end
|
78
80
|
|
79
81
|
def _deprecated(message)
|
data/lib/guard/rspec/dsl.rb
CHANGED
@@ -10,7 +10,7 @@ module Guard
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def watch_spec_files_for(expr)
|
13
|
-
@dsl.send(:watch, expr) { |m| rspec.spec.(m[1]) }
|
13
|
+
@dsl.send(:watch, expr) { |m| rspec.spec.call(m[1]) }
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.detect_spec_file_for(rspec, file)
|
@@ -21,7 +21,7 @@ module Guard
|
|
21
21
|
return path unless file.start_with?("lib/")
|
22
22
|
return path if Dir.exist?("#{rspec.spec_dir}/lib")
|
23
23
|
|
24
|
-
without_lib = file.sub(
|
24
|
+
without_lib = file.sub(%r{^lib/}, "")
|
25
25
|
"#{rspec.spec_dir}/#{without_lib}_spec.rb"
|
26
26
|
end
|
27
27
|
|
@@ -44,9 +44,17 @@ module Guard
|
|
44
44
|
|
45
45
|
def rails(options = {})
|
46
46
|
# Rails example
|
47
|
-
@rails ||=
|
48
|
-
|
47
|
+
@rails ||= _build_rails_rules(_view_extensions(options) * "|")
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def _view_extensions(options)
|
53
|
+
options.dup.delete(:view_extensions) || %w(erb haml slim)
|
54
|
+
end
|
49
55
|
|
56
|
+
def _build_rails_rules(exts)
|
57
|
+
OpenStruct.new.tap do |rails|
|
50
58
|
rails.app_files = %r{^app/(.+)\.rb$}
|
51
59
|
|
52
60
|
rails.views = %r{^app/(views/.+/[^/]*\.(?:#{exts}))$}
|
@@ -59,12 +67,6 @@ module Guard
|
|
59
67
|
rails.spec_helper = "#{rspec.spec_dir}/rails_helper.rb"
|
60
68
|
end
|
61
69
|
end
|
62
|
-
|
63
|
-
private
|
64
|
-
|
65
|
-
def _view_extensions(options)
|
66
|
-
options.dup.delete(:view_extensions) || %w(erb haml slim)
|
67
|
-
end
|
68
70
|
end
|
69
71
|
end
|
70
72
|
end
|
@@ -11,15 +11,15 @@ module Guard
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def paths(_paths)
|
14
|
-
|
14
|
+
raise NotImplementedError
|
15
15
|
end
|
16
16
|
|
17
17
|
def failed(_locations)
|
18
|
-
|
18
|
+
raise NotImplementedError
|
19
19
|
end
|
20
20
|
|
21
21
|
def reload
|
22
|
-
|
22
|
+
raise NotImplementedError
|
23
23
|
end
|
24
24
|
|
25
25
|
private
|
data/lib/guard/rspec/notifier.rb
CHANGED
data/lib/guard/rspec/results.rb
CHANGED
@@ -11,7 +11,7 @@ module Guard
|
|
11
11
|
lines = File.readlines(filename)
|
12
12
|
if lines.empty? || lines.first.empty?
|
13
13
|
dump = lines.inspect
|
14
|
-
|
14
|
+
raise InvalidData, "Invalid results in: #{filename},"\
|
15
15
|
" lines:\n#{dump}\n"
|
16
16
|
end
|
17
17
|
|
@@ -26,8 +26,13 @@ module Guard
|
|
26
26
|
def _run
|
27
27
|
_without_bundler_env do
|
28
28
|
exit_code = _really_run
|
29
|
+
|
30
|
+
msg = "Guard::RSpec: RSpec command %s exited with: %s"
|
31
|
+
Compat::UI.debug(format(msg, command, exit_code.inspect))
|
32
|
+
|
29
33
|
unless [0, Command::FAILURE_EXIT_CODE].include?(exit_code)
|
30
|
-
|
34
|
+
msg = "Failed: %s (exit code: %d)"
|
35
|
+
raise Failure, format(msg, command.inspect, exit_code)
|
31
36
|
end
|
32
37
|
exit_code
|
33
38
|
end
|
@@ -35,15 +40,27 @@ module Guard
|
|
35
40
|
|
36
41
|
def _really_run
|
37
42
|
env = { "GUARD_RSPEC_RESULTS_FILE" => formatter_tmp_file }
|
43
|
+
|
44
|
+
_warn_unless_absolute_path(formatter_tmp_file)
|
45
|
+
|
46
|
+
Compat::UI.debug("Guard::RSpec: results file: #{formatter_tmp_file}")
|
47
|
+
|
38
48
|
pid = Kernel.spawn(env, command) # use spawn to stub in JRuby
|
39
49
|
result = ::Process.wait2(pid)
|
40
50
|
result.last.exitstatus
|
41
51
|
rescue Errno::ENOENT => ex
|
42
|
-
|
52
|
+
raise Failure, "Failed: #{command.inspect} (#{ex})"
|
43
53
|
end
|
44
54
|
|
45
55
|
def _read_results
|
46
56
|
Results.new(formatter_tmp_file)
|
57
|
+
rescue Errno::ENOENT
|
58
|
+
msg = "Guard::RSpec cannot open results file: %s. This is likely a bug"\
|
59
|
+
"so please report this at"\
|
60
|
+
" http://github.com/guard/guard-rspec/issues/new along with as much"\
|
61
|
+
"information as possible to reproduce this issue."
|
62
|
+
Compat::UI.error(format(msg, formatter_tmp_file.inspect))
|
63
|
+
raise
|
47
64
|
ensure
|
48
65
|
File.delete(formatter_tmp_file) if File.exist?(formatter_tmp_file)
|
49
66
|
end
|
@@ -56,6 +73,14 @@ module Guard
|
|
56
73
|
end
|
57
74
|
end
|
58
75
|
|
76
|
+
def _warn_unless_absolute_path(formatter_tmp_file)
|
77
|
+
return if Pathname(formatter_tmp_file).absolute?
|
78
|
+
|
79
|
+
msg = "Guard::RSpec: The results file %s is not an absolute path."\
|
80
|
+
" Please provide an absolute path to avoid issues."
|
81
|
+
Compat::UI.warning(format(msg, formatter_tmp_file.inspect))
|
82
|
+
end
|
83
|
+
|
59
84
|
attr_reader :command
|
60
85
|
attr_reader :exit_code
|
61
86
|
attr_reader :formatter_tmp_file
|
data/lib/guard/rspec/runner.rb
CHANGED
@@ -15,9 +15,6 @@ module Guard
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
# NOTE: must match with const in RSpecFormatter!
|
19
|
-
TEMPORARY_FILE_PATH ||= "tmp/rspec_guard_result".freeze
|
20
|
-
|
21
18
|
attr_accessor :options, :inspector, :notifier
|
22
19
|
|
23
20
|
def initialize(options = {})
|
@@ -52,7 +49,7 @@ module Guard
|
|
52
49
|
private
|
53
50
|
|
54
51
|
def _run(paths, options, &block)
|
55
|
-
|
52
|
+
raise NoCmdOptionError unless options[:cmd]
|
56
53
|
command = Command.new(paths, options)
|
57
54
|
_really_run(command, options, &block)
|
58
55
|
rescue RSpecProcess::Failure, NoCmdOptionError => ex
|
@@ -73,11 +70,8 @@ module Guard
|
|
73
70
|
_open_launchy
|
74
71
|
|
75
72
|
all_green = process.all_green?
|
76
|
-
if block_given?
|
77
|
-
|
78
|
-
else
|
79
|
-
all_green
|
80
|
-
end
|
73
|
+
return yield all_green if block_given?
|
74
|
+
all_green
|
81
75
|
end
|
82
76
|
|
83
77
|
def _open_launchy
|
@@ -88,9 +82,18 @@ module Guard
|
|
88
82
|
end
|
89
83
|
|
90
84
|
def _results_file(results_file, chdir)
|
91
|
-
results_file ||= RSpecDefaults::TEMPORARY_FILE_PATH
|
85
|
+
results_file ||= File.expand_path(RSpecDefaults::TEMPORARY_FILE_PATH)
|
86
|
+
return results_file unless Pathname(results_file).relative?
|
87
|
+
results_file = File.join(chdir, results_file) if chdir
|
92
88
|
return results_file unless Pathname(results_file).relative?
|
93
|
-
|
89
|
+
|
90
|
+
unless Pathname(results_file).absolute?
|
91
|
+
msg = "Guard::RSpec: The results file %s is not an absolute path."\
|
92
|
+
" Please provide an absolute path to avoid issues."
|
93
|
+
Compat::UI.warning(format(msg, results_file.inspect))
|
94
|
+
end
|
95
|
+
|
96
|
+
File.expand_path(results_file)
|
94
97
|
end
|
95
98
|
end
|
96
99
|
end
|
@@ -30,9 +30,9 @@ guard :rspec, cmd: "bundle exec rspec" do
|
|
30
30
|
|
31
31
|
watch(rails.controllers) do |m|
|
32
32
|
[
|
33
|
-
rspec.spec.("routing/#{m[1]}_routing"),
|
34
|
-
rspec.spec.("controllers/#{m[1]}_controller"),
|
35
|
-
rspec.spec.("acceptance/#{m[1]}")
|
33
|
+
rspec.spec.call("routing/#{m[1]}_routing"),
|
34
|
+
rspec.spec.call("controllers/#{m[1]}_controller"),
|
35
|
+
rspec.spec.call("acceptance/#{m[1]}")
|
36
36
|
]
|
37
37
|
end
|
38
38
|
|
@@ -42,8 +42,8 @@ guard :rspec, cmd: "bundle exec rspec" do
|
|
42
42
|
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
43
43
|
|
44
44
|
# Capybara features specs
|
45
|
-
watch(rails.view_dirs) { |m| rspec.spec.("features/#{m[1]}") }
|
46
|
-
watch(rails.layouts) { |m| rspec.spec.("features/#{m[1]}") }
|
45
|
+
watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
|
46
|
+
watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
|
47
47
|
|
48
48
|
# Turnip features and steps
|
49
49
|
watch(%r{^spec/acceptance/(.+)\.feature$})
|