guard-rspec 2.1.0 → 4.7.3
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 +7 -0
- data/.gitignore +10 -0
- data/.hound.yml +3 -0
- data/.rspec +2 -0
- data/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +40 -0
- data/.travis.yml +14 -0
- data/CONTRIBUTING.md +38 -0
- data/Gemfile +25 -0
- data/Guardfile +28 -0
- data/{LICENSE → LICENSE.txt} +4 -2
- data/README.md +99 -114
- data/Rakefile +38 -0
- data/gemfiles/Gemfile.rspec-2.99 +6 -0
- data/gemfiles/Gemfile.rspec-3.4 +6 -0
- data/gemfiles/common +9 -0
- data/guard-rspec.gemspec +25 -0
- data/lib/guard/rspec/command.rb +71 -0
- data/lib/guard/rspec/deprecator.rb +86 -0
- data/lib/guard/rspec/dsl.rb +72 -0
- data/lib/guard/rspec/inspectors/base_inspector.rb +73 -0
- data/lib/guard/rspec/inspectors/factory.rb +23 -0
- data/lib/guard/rspec/inspectors/focused_inspector.rb +39 -0
- data/lib/guard/rspec/inspectors/keeping_inspector.rb +97 -0
- data/lib/guard/rspec/inspectors/simple_inspector.rb +21 -0
- data/lib/guard/rspec/notifier.rb +55 -0
- data/lib/guard/rspec/options.rb +37 -0
- data/lib/guard/rspec/results.rb +23 -0
- data/lib/guard/rspec/rspec_process.rb +93 -0
- data/lib/guard/rspec/runner.rb +71 -174
- data/lib/guard/rspec/templates/Guardfile +49 -17
- data/lib/guard/rspec/version.rb +1 -1
- data/lib/guard/rspec.rb +30 -59
- data/lib/guard/rspec_defaults.rb +5 -0
- data/lib/guard/rspec_formatter.rb +147 -0
- data/lib/guard/rspec_formatter_results_path.rb +29 -0
- data/spec/acceptance/fixtures/succeeding_spec.rb +4 -0
- data/spec/acceptance/formatter_spec.rb +46 -0
- data/spec/lib/guard/rspec/command_spec.rb +95 -0
- data/spec/lib/guard/rspec/deprecator_spec.rb +101 -0
- data/spec/lib/guard/rspec/inspectors/base_inspector_spec.rb +144 -0
- data/spec/lib/guard/rspec/inspectors/factory_spec.rb +45 -0
- data/spec/lib/guard/rspec/inspectors/focused_inspector_spec.rb +140 -0
- data/spec/lib/guard/rspec/inspectors/keeping_inspector_spec.rb +200 -0
- data/spec/lib/guard/rspec/inspectors/shared_examples.rb +121 -0
- data/spec/lib/guard/rspec/inspectors/simple_inspector_spec.rb +59 -0
- data/spec/lib/guard/rspec/notifier_spec.rb +90 -0
- data/spec/lib/guard/rspec/results_spec.rb +66 -0
- data/spec/lib/guard/rspec/rspec_process_spec.rb +152 -0
- data/spec/lib/guard/rspec/runner_spec.rb +372 -0
- data/spec/lib/guard/rspec/template_spec.rb +78 -0
- data/spec/lib/guard/rspec_formatter_spec.rb +277 -0
- data/spec/lib/guard/rspec_spec.rb +91 -0
- data/spec/spec_helper.rb +145 -0
- metadata +103 -42
- data/lib/guard/rspec/formatter.rb +0 -56
- data/lib/guard/rspec/inspector.rb +0 -72
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9f60e3dd503909fe6029b421e95d895ab27acde8
|
4
|
+
data.tar.gz: 810b86b4f0dff2ad8e269877d4eef0e4c17effb6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 593cf6747a4ef7e21d25f8bba6b27dc56dcb15cab6aca0bed634853cdeea0d18f9452e0a7aad84ea42bd364144138f426a107a83754242b09ebfa293055f4281
|
7
|
+
data.tar.gz: 5118ee63611b3af14955ec4481d528facbff713edeeec05229afefd3033b800ab839e274203c8b57424549ab248cdceb2408bba7920ae3f289127fa5fff6452b
|
data/.gitignore
ADDED
data/.hound.yml
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,40 @@
|
|
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.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
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
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
language: ruby
|
2
|
+
bundler_args: --without=tool development
|
3
|
+
rvm:
|
4
|
+
- 2.2.5
|
5
|
+
- 2.3.1
|
6
|
+
- jruby-9.1.1.0
|
7
|
+
gemfile:
|
8
|
+
- gemfiles/Gemfile.rspec-2.99
|
9
|
+
- gemfiles/Gemfile.rspec-3.4
|
10
|
+
matrix:
|
11
|
+
allow_failures:
|
12
|
+
- rvm: jruby-9.1.1.0
|
13
|
+
sudo: false
|
14
|
+
cache: bundler
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
Contribute to Guard::RSpec
|
2
|
+
==========================
|
3
|
+
|
4
|
+
File an issue
|
5
|
+
-------------
|
6
|
+
|
7
|
+
You can report bugs and feature requests to [GitHub Issues](https://github.com/guard/guard-rspec/issues).
|
8
|
+
|
9
|
+
**Please don't ask question in the issue tracker**, instead ask them on at Stack Overflow and use the
|
10
|
+
[guard](http://stackoverflow.com/questions/tagged/guard) tag and/or [guard-rspec](http://stackoverflow.com/questions/tagged/guard-rspec).
|
11
|
+
|
12
|
+
Try to figure out where the issue belongs to: Is it an issue with Guard::RSpec itself or with Guard?
|
13
|
+
|
14
|
+
When you file a bug, please try to follow these simple rules if applicable:
|
15
|
+
|
16
|
+
* Make sure you've read the README carefully.
|
17
|
+
* Make sure you run Guard with `bundle exec` first.
|
18
|
+
* Add debug information to the issue by running Guard with the `--debug` option.
|
19
|
+
* Add your `Guardfile` and `Gemfile` to the issue.
|
20
|
+
* Make sure that the issue is reproducible with your description.
|
21
|
+
|
22
|
+
**It's most likely that your bug gets resolved faster if you provide as much information as possible!**
|
23
|
+
|
24
|
+
Development
|
25
|
+
-----------
|
26
|
+
|
27
|
+
* Documentation hosted at [RubyDoc](http://rubydoc.info/github/guard/guard-rspec/master/frames).
|
28
|
+
* Source hosted at [GitHub](https://github.com/guard/guard-rspec).
|
29
|
+
|
30
|
+
Pull requests are very welcome! Please try to follow these simple rules if applicable:
|
31
|
+
|
32
|
+
* Please create a topic branch for every separate change you make.
|
33
|
+
* Make sure your patches are well tested. All specs run with `rake test:all_versions` must pass.
|
34
|
+
* Update the [README](https://github.com/guard/guard-rspec/blob/master/README.md).
|
35
|
+
* Please **do not change** the version number.
|
36
|
+
|
37
|
+
For questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
|
38
|
+
`#guard` (irc.freenode.net).
|
data/Gemfile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Note: on Travis, this Gemfile is only for installing
|
2
|
+
# dependencies. The actual builds use the Gemfiles in
|
3
|
+
# the gemspecs/* directory.
|
4
|
+
|
5
|
+
filename = "gemfiles/common"
|
6
|
+
instance_eval(IO.read(filename), filename, 1)
|
7
|
+
|
8
|
+
group :test do
|
9
|
+
gem "rspec", "~> 3.4"
|
10
|
+
end
|
11
|
+
|
12
|
+
if ENV["USE_INSTALLED_GUARD_RSPEC"] == "1"
|
13
|
+
gem "guard-rspec"
|
14
|
+
else
|
15
|
+
gemspec development_group: :gem_build_tools
|
16
|
+
end
|
17
|
+
|
18
|
+
group :gem_build_tools do
|
19
|
+
end
|
20
|
+
|
21
|
+
group :development do
|
22
|
+
gem "rubocop", require: false
|
23
|
+
gem "guard-rubocop", require: false
|
24
|
+
gem "guard-compat", ">= 0.0.2", require: false
|
25
|
+
end
|
data/Guardfile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
group :specs, halt_on_fail: true do
|
2
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
3
|
+
require "guard/rspec/dsl"
|
4
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
5
|
+
|
6
|
+
# RSpec files
|
7
|
+
rspec = dsl.rspec
|
8
|
+
watch(rspec.spec_files)
|
9
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
10
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
11
|
+
|
12
|
+
# Ruby files
|
13
|
+
dsl.watch_spec_files_for(dsl.ruby.lib_files)
|
14
|
+
|
15
|
+
watch(%r{^(lib/guard/rspec/template)s/Guardfile$}) do
|
16
|
+
rspec.spec.call("lib/guard/rspec/template")
|
17
|
+
end
|
18
|
+
|
19
|
+
watch(%r{^lib/guard/rspec/dsl.rb$}) do
|
20
|
+
rspec.spec.call("lib/guard/rspec/template")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
guard :rubocop, all_on_start: false do
|
25
|
+
watch(/.+\.rb$/)
|
26
|
+
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
27
|
+
end
|
28
|
+
end
|
data/{LICENSE → LICENSE.txt}
RENAMED
@@ -1,4 +1,6 @@
|
|
1
|
-
Copyright (c) 2010-
|
1
|
+
Copyright (c) 2010-2016 Thibaud Guillaume-Gentil
|
2
|
+
|
3
|
+
MIT License
|
2
4
|
|
3
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
6
|
a copy of this software and associated documentation files (the
|
@@ -17,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,46 +1,60 @@
|
|
1
|
-
# Guard::RSpec
|
1
|
+
# Guard::RSpec
|
2
2
|
|
3
|
-
|
3
|
+
[](http://badge.fury.io/rb/guard-rspec) [](http://travis-ci.org/guard/guard-rspec) [](https://gemnasium.com/guard/guard-rspec) [](https://codeclimate.com/github/guard/guard-rspec) [](https://coveralls.io/r/guard/guard-rspec)
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
Guard::RSpec allows to automatically & intelligently launch specs when files are modified.
|
6
|
+
|
7
|
+
* Compatible with RSpec >2.99 & 3
|
8
|
+
* Tested against Ruby 2.2.x, JRuby 9.0.5.0 ~~and Rubinius~~.
|
7
9
|
|
8
10
|
## Install
|
9
11
|
|
10
|
-
|
12
|
+
Add the gem to your Gemfile (inside development group):
|
11
13
|
|
12
|
-
|
14
|
+
``` ruby
|
15
|
+
gem 'guard-rspec', require: false
|
16
|
+
```
|
17
|
+
|
18
|
+
Add guard definition to your Guardfile by running this command:
|
13
19
|
|
14
20
|
```
|
15
|
-
$
|
21
|
+
$ bundle exec guard init rspec
|
16
22
|
```
|
17
23
|
|
18
|
-
|
24
|
+
## Installing with beta versions of RSpec
|
19
25
|
|
20
|
-
|
21
|
-
group :development do
|
22
|
-
gem 'guard-rspec'
|
23
|
-
end
|
24
|
-
```
|
26
|
+
To install beta versions of RSpec, you need to set versions of all the dependencies, e.g:
|
25
27
|
|
26
|
-
|
28
|
+
```ruby
|
29
|
+
gem 'rspec', '= 3.5.0.beta3'
|
30
|
+
gem 'rspec-core', '= 3.5.0.beta3'
|
31
|
+
gem 'rspec-expectations', '= 3.5.0.beta3'
|
32
|
+
gem 'rspec-mocks', '= 3.5.0.beta3'
|
33
|
+
gem 'rspec-support', '= 3.5.0.beta3'
|
27
34
|
|
35
|
+
gem 'guard-rspec', '~> 4.7'
|
28
36
|
```
|
29
|
-
|
37
|
+
|
38
|
+
and for Rails projects this also means adding:
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
gem 'rspec-rails', '= 3.5.0.beta3'
|
30
42
|
```
|
31
43
|
|
44
|
+
and then running `bundle update rspec rspec-core rspec-expectations rspec-mocks rspec-support rspec-rails` or just `bundle update` to update all the gems in your project.
|
45
|
+
|
32
46
|
## Usage
|
33
47
|
|
34
|
-
Please read [Guard usage doc](https://github.com/guard/guard#readme)
|
48
|
+
Please read [Guard usage doc](https://github.com/guard/guard#readme).
|
35
49
|
|
36
50
|
## Guardfile
|
37
51
|
|
38
|
-
RSpec
|
52
|
+
Guard::RSpec can be adapted to all kinds of projects, some examples:
|
39
53
|
|
40
54
|
### Standard RubyGem project
|
41
55
|
|
42
56
|
``` ruby
|
43
|
-
guard 'rspec' do
|
57
|
+
guard :rspec, cmd: 'rspec' do
|
44
58
|
watch(%r{^spec/.+_spec\.rb$})
|
45
59
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
46
60
|
watch('spec/spec_helper.rb') { "spec" }
|
@@ -50,13 +64,13 @@ end
|
|
50
64
|
### Typical Rails app
|
51
65
|
|
52
66
|
``` ruby
|
53
|
-
guard 'rspec' do
|
67
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
54
68
|
watch('spec/spec_helper.rb') { "spec" }
|
55
69
|
watch('config/routes.rb') { "spec/routing" }
|
56
70
|
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
57
71
|
watch(%r{^spec/.+_spec\.rb$})
|
58
72
|
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
59
|
-
watch(%r{^app/(.*)(\.erb|\.haml)$})
|
73
|
+
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
60
74
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
61
75
|
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
62
76
|
end
|
@@ -66,137 +80,108 @@ Please read [Guard doc](https://github.com/guard/guard#readme) for more informat
|
|
66
80
|
|
67
81
|
## Options
|
68
82
|
|
69
|
-
|
83
|
+
Guard::RSpec 4.0 now uses a simpler approach with the new `cmd` option that let you precisely define which rspec command will be launched on each run. **This option is required** due to the number of different ways possible to invoke rspec, the template now includes a default that should work for most applications but may not be optimal for all. As example if you want to support Spring with a custom formatter (progress by default) use:
|
70
84
|
|
71
85
|
``` ruby
|
72
|
-
guard
|
86
|
+
guard :rspec, cmd: 'spring rspec -f doc' do
|
73
87
|
# ...
|
74
88
|
end
|
75
89
|
```
|
76
90
|
|
77
|
-
|
91
|
+
NOTE: the above example assumes you have the `spring rspec` command installed - see here: https://github.com/jonleighton/spring-commands-rspec
|
78
92
|
|
79
|
-
|
80
|
-
guard 'rspec', :spec_paths => ["spec", "vendor/engines/reset/spec"] do
|
81
|
-
# ...
|
82
|
-
end
|
83
|
-
```
|
84
|
-
If you have only one path to look, you can configure `:spec_paths` option with a string:
|
93
|
+
### Running with bundler
|
85
94
|
|
86
|
-
|
87
|
-
guard 'rspec', :spec_paths => "test" do
|
88
|
-
# ...
|
89
|
-
end
|
90
|
-
```
|
91
|
-
If you want to set an environment variable, you can configure `:env` option with a hash:
|
95
|
+
Running `bundle exec guard` will not run the specs with bundler. You need to change the `cmd` option to `bundle exec rspec`:
|
92
96
|
|
93
97
|
``` ruby
|
94
|
-
guard
|
98
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
95
99
|
# ...
|
96
100
|
end
|
97
101
|
```
|
98
|
-
[Turnip](https://github.com/jnicklas/turnip) is supported (Ruby 1.9.X only), but you must enable it:
|
99
|
-
``` ruby
|
100
|
-
guard 'rspec', :turnip => true do
|
101
|
-
# ...
|
102
|
-
end
|
103
|
-
```
|
104
|
-
|
105
|
-
|
106
|
-
Former `:color`, `:drb`, `:fail_fast` and `:formatter` options are deprecated and have no effect anymore.
|
107
102
|
|
108
103
|
### List of available options:
|
109
104
|
|
110
105
|
``` ruby
|
111
|
-
:
|
112
|
-
:
|
113
|
-
|
114
|
-
:
|
115
|
-
:
|
116
|
-
|
117
|
-
:
|
118
|
-
:
|
119
|
-
:
|
120
|
-
:
|
121
|
-
:
|
122
|
-
:
|
106
|
+
cmd: 'zeus rspec' # Specify a custom rspec command to run, default: 'rspec'
|
107
|
+
cmd_additional_args: '-f progress' # Any arguments that should be added after the default
|
108
|
+
# arguments are applied but before the spec list
|
109
|
+
spec_paths: ['spec'] # Specify a custom array of paths that contain spec files
|
110
|
+
failed_mode: :focus # What to do with failed specs
|
111
|
+
# Available values:
|
112
|
+
# :focus - focus on the first 10 failed specs, rerun till they pass
|
113
|
+
# :keep - keep failed specs until they pass (add them to new ones)
|
114
|
+
# :none (default) - just report
|
115
|
+
all_after_pass: true # Run all specs after changed specs pass, default: false
|
116
|
+
all_on_start: true # Run all the specs at startup, default: false
|
117
|
+
launchy: nil # Pass a path to an rspec results file, e.g. ./tmp/spec_results.html
|
118
|
+
notification: false # Display notification after the specs are done running, default: true
|
119
|
+
run_all: { cmd: 'custom rspec command', message: 'custom message' } # Custom options to use when running all specs
|
120
|
+
title: 'My project' # Display a custom title for the notification, default: 'RSpec results'
|
121
|
+
chdir: 'directory' # run rspec from within a given subdirectory (useful if project has separate specs for submodules)
|
122
|
+
results_file: 'some/path' # use the given file for storing results (instead of default relative path)
|
123
|
+
bundler_env: :original_env # Specify which Bundler env to run the cmd under, default: :original_env
|
124
|
+
# Available values:
|
125
|
+
# :clean_env - old behavior, uses Bundler environment with all bundler-related variables removed. This is deprecated in bundler 1.12.x.
|
126
|
+
# :original_env (default) - uses Bundler environment present before Bundler was activated
|
127
|
+
# :inherit - runs inside the current environment
|
123
128
|
```
|
124
129
|
|
125
|
-
|
126
|
-
|
127
|
-
### DRb mode
|
128
|
-
|
129
|
-
When you specify `--drb` within `:cli`, guard-rspec will circumvent the `rspec` command line tool by
|
130
|
-
directly communicating with the RSpec DRb server. This avoids the extra overhead incurred by your
|
131
|
-
shell, bundler and loading RSpec's environment just to send a DRb message. It shaves off a
|
132
|
-
second or two before the specs start to run; they should run almost immediately.
|
133
|
-
|
134
|
-
|
135
|
-
Notification
|
136
|
-
------------
|
130
|
+
### Using Launchy to view rspec results
|
137
131
|
|
138
|
-
|
139
|
-
|
140
|
-
The best solution is still to update RSpec to the latest version!
|
141
|
-
|
142
|
-
Formatters
|
143
|
-
----------
|
144
|
-
|
145
|
-
The `:formatter` option has been removed since CLI arguments can be passed through the `:cli` option. If you want to use the former Instafail formatter, you need to use [rspec-instafail](http://rubygems.org/gems/rspec-instafail) gem instead:
|
132
|
+
guard-rspec can be configured to launch a results file in lieu of outputing rspec results to the terminal.
|
133
|
+
Configure your Guardfile with the launchy option:
|
146
134
|
|
147
135
|
``` ruby
|
148
|
-
|
149
|
-
gem 'rspec-instafail'
|
150
|
-
|
151
|
-
# in your Guardfile
|
152
|
-
guard 'rspec', :cli => '-r rspec/instafail -f RSpec::Instafail' do
|
136
|
+
guard :rspec, cmd: 'rspec -f html -o ./tmp/spec_results.html', launchy: './tmp/spec_results.html' do
|
153
137
|
# ...
|
154
138
|
end
|
155
139
|
```
|
156
140
|
|
157
|
-
|
141
|
+
### Zeus Integration
|
158
142
|
|
159
|
-
|
160
|
-
-----------
|
143
|
+
You can use plain `Zeus` or you can use `Guard::Zeus` for managing the `Zeus` server (but you'll want to remove the spec watchers from `Guard::Zeus`, or you'll have tests running multiple times).
|
161
144
|
|
162
|
-
|
163
|
-
are some specs you want to skip, you can tag them with RSpec metadata (such as `:slow => true`)
|
164
|
-
and skip them with the cli `--tag` option (i.e. `--tag ~slow`).
|
145
|
+
Also, if you get warnings about empty environment, be sure to [read about this workaround](https://github.com/guard/guard-rspec/wiki/Warning:-no-environment)
|
165
146
|
|
166
|
-
|
167
|
-
You can use this feature to create multiple groups of guarded specs with distinct paths, and execute each in own process:
|
147
|
+
### Using parallel_tests
|
168
148
|
|
169
|
-
|
170
|
-
# in your Guardfile
|
171
|
-
group 'acceptance-tests' do
|
172
|
-
guard 'rspec', :spec_paths => ['spec/acceptance'] do
|
173
|
-
# ...
|
174
|
-
end
|
175
|
-
end
|
149
|
+
parallel_tests has a `-o` option for passing RSpec options, and here's a trick to make it work with Guard::RSpec:
|
176
150
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
151
|
+
```ruby
|
152
|
+
rspec_options = {
|
153
|
+
cmd: "bundle exec rspec",
|
154
|
+
run_all: {
|
155
|
+
cmd: "bundle exec parallel_rspec -o '",
|
156
|
+
cmd_additional_args: "'"
|
157
|
+
}
|
158
|
+
}
|
159
|
+
guard :rspec, rspec_options do
|
160
|
+
# (...)
|
182
161
|
```
|
183
162
|
|
163
|
+
(Notice where the `'` characters are placed)
|
164
|
+
|
165
|
+
|
166
|
+
## Development
|
167
|
+
|
168
|
+
* Documentation hosted at [RubyDoc](http://rubydoc.info/github/guard/guard-rspec/master/frames).
|
169
|
+
* Source hosted at [GitHub](https://github.com/guard/guard-rspec).
|
184
170
|
|
185
|
-
|
186
|
-
-----------
|
171
|
+
Pull requests are very welcome! Please try to follow these simple rules if applicable:
|
187
172
|
|
188
|
-
*
|
189
|
-
*
|
173
|
+
* Please create a topic branch for every separate change you make.
|
174
|
+
* Make sure your patches are well tested. All specs run with `rake spec:portability` must pass.
|
175
|
+
* Update the [README](https://github.com/guard/guard-rspec/blob/master/README.md).
|
176
|
+
* Please **do not change** the version number.
|
190
177
|
|
191
|
-
|
192
|
-
|
178
|
+
For questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
|
179
|
+
`#guard` (irc.freenode.net).
|
193
180
|
|
194
|
-
|
195
|
-
-------
|
181
|
+
### Author
|
196
182
|
|
197
|
-
|
183
|
+
[Thibaud Guillaume-Gentil](https://github.com/thibaudgg) ([@thibaudgg](https://twitter.com/thibaudgg))
|
198
184
|
|
199
|
-
|
200
|
-
------
|
185
|
+
### Contributors
|
201
186
|
|
202
|
-
[
|
187
|
+
[https://github.com/guard/guard-rspec/contributors](https://github.com/guard/guard-rspec/contributors)
|
data/Rakefile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require "nenv"
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
require "yaml"
|
4
|
+
|
5
|
+
default_tasks = []
|
6
|
+
|
7
|
+
require "rspec/core/rake_task"
|
8
|
+
default_tasks << RSpec::Core::RakeTask.new(:spec) do |t|
|
9
|
+
t.verbose = Nenv.ci?
|
10
|
+
end
|
11
|
+
|
12
|
+
unless Nenv.ci?
|
13
|
+
require "rubocop/rake_task"
|
14
|
+
default_tasks << RuboCop::RakeTask.new(:rubocop)
|
15
|
+
end
|
16
|
+
|
17
|
+
task default: default_tasks.map(&:name)
|
18
|
+
|
19
|
+
namespace :test do
|
20
|
+
desc "Locally run tests like Travis and HoundCI would"
|
21
|
+
task :all_versions do
|
22
|
+
system(*%w(bundle install --quiet)) || abort
|
23
|
+
system(*%w(bundle update --quiet)) || abort
|
24
|
+
system(*%w(bundle exec rubocop -c .rubocop.yml)) || abort
|
25
|
+
|
26
|
+
travis = YAML.load(IO.read(".travis.yml"))
|
27
|
+
travis["gemfile"].each do |gemfile|
|
28
|
+
STDOUT.puts
|
29
|
+
STDOUT.puts "----------------------------------------------------- "
|
30
|
+
STDOUT.puts " >> Running tests using Gemfile: #{gemfile} <<"
|
31
|
+
STDOUT.puts "----------------------------------------------------- "
|
32
|
+
env = { "BUNDLE_GEMFILE" => gemfile }
|
33
|
+
system(env, *%w(bundle install --quiet)) || abort
|
34
|
+
system(env, *%w(bundle update --quiet)) || abort
|
35
|
+
system(env, *%w(bundle exec rspec)) || abort
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/gemfiles/common
ADDED
data/guard-rspec.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "guard/rspec/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "guard-rspec"
|
8
|
+
s.version = Guard::RSpecVersion::VERSION
|
9
|
+
s.author = "Thibaud Guillaume-Gentil"
|
10
|
+
s.email = "thibaud@thibaud.gg"
|
11
|
+
s.summary = "Guard gem for RSpec"
|
12
|
+
s.description = "Guard::RSpec automatically run your specs" \
|
13
|
+
" (much like autotest)."
|
14
|
+
|
15
|
+
s.homepage = "https://github.com/guard/guard-rspec"
|
16
|
+
s.license = "MIT"
|
17
|
+
|
18
|
+
s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
19
|
+
s.test_files = s.files.grep(%r{^spec/})
|
20
|
+
s.require_path = "lib"
|
21
|
+
|
22
|
+
s.add_dependency "guard", "~> 2.1"
|
23
|
+
s.add_dependency "guard-compat", "~> 1.1"
|
24
|
+
s.add_dependency "rspec", ">= 2.99.0", "< 4.0"
|
25
|
+
end
|