guard-rspec 2.1.0 → 4.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.hound.yml +3 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +5 -0
  6. data/.rubocop_todo.yml +40 -0
  7. data/.travis.yml +14 -0
  8. data/CONTRIBUTING.md +38 -0
  9. data/Gemfile +25 -0
  10. data/Guardfile +28 -0
  11. data/{LICENSE → LICENSE.txt} +4 -2
  12. data/README.md +99 -114
  13. data/Rakefile +38 -0
  14. data/gemfiles/Gemfile.rspec-2.99 +6 -0
  15. data/gemfiles/Gemfile.rspec-3.4 +6 -0
  16. data/gemfiles/common +9 -0
  17. data/guard-rspec.gemspec +25 -0
  18. data/lib/guard/rspec/command.rb +71 -0
  19. data/lib/guard/rspec/deprecator.rb +86 -0
  20. data/lib/guard/rspec/dsl.rb +72 -0
  21. data/lib/guard/rspec/inspectors/base_inspector.rb +73 -0
  22. data/lib/guard/rspec/inspectors/factory.rb +23 -0
  23. data/lib/guard/rspec/inspectors/focused_inspector.rb +39 -0
  24. data/lib/guard/rspec/inspectors/keeping_inspector.rb +97 -0
  25. data/lib/guard/rspec/inspectors/simple_inspector.rb +21 -0
  26. data/lib/guard/rspec/notifier.rb +55 -0
  27. data/lib/guard/rspec/options.rb +37 -0
  28. data/lib/guard/rspec/results.rb +23 -0
  29. data/lib/guard/rspec/rspec_process.rb +93 -0
  30. data/lib/guard/rspec/runner.rb +71 -174
  31. data/lib/guard/rspec/templates/Guardfile +49 -17
  32. data/lib/guard/rspec/version.rb +1 -1
  33. data/lib/guard/rspec.rb +30 -59
  34. data/lib/guard/rspec_defaults.rb +5 -0
  35. data/lib/guard/rspec_formatter.rb +147 -0
  36. data/lib/guard/rspec_formatter_results_path.rb +29 -0
  37. data/spec/acceptance/fixtures/succeeding_spec.rb +4 -0
  38. data/spec/acceptance/formatter_spec.rb +46 -0
  39. data/spec/lib/guard/rspec/command_spec.rb +95 -0
  40. data/spec/lib/guard/rspec/deprecator_spec.rb +101 -0
  41. data/spec/lib/guard/rspec/inspectors/base_inspector_spec.rb +144 -0
  42. data/spec/lib/guard/rspec/inspectors/factory_spec.rb +45 -0
  43. data/spec/lib/guard/rspec/inspectors/focused_inspector_spec.rb +140 -0
  44. data/spec/lib/guard/rspec/inspectors/keeping_inspector_spec.rb +200 -0
  45. data/spec/lib/guard/rspec/inspectors/shared_examples.rb +121 -0
  46. data/spec/lib/guard/rspec/inspectors/simple_inspector_spec.rb +59 -0
  47. data/spec/lib/guard/rspec/notifier_spec.rb +90 -0
  48. data/spec/lib/guard/rspec/results_spec.rb +66 -0
  49. data/spec/lib/guard/rspec/rspec_process_spec.rb +152 -0
  50. data/spec/lib/guard/rspec/runner_spec.rb +372 -0
  51. data/spec/lib/guard/rspec/template_spec.rb +78 -0
  52. data/spec/lib/guard/rspec_formatter_spec.rb +277 -0
  53. data/spec/lib/guard/rspec_spec.rb +91 -0
  54. data/spec/spec_helper.rb +145 -0
  55. metadata +103 -42
  56. data/lib/guard/rspec/formatter.rb +0 -56
  57. 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
@@ -0,0 +1,10 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
4
+ .DS_Store
5
+ .rvmrc
6
+ .rbx/*
7
+ Gemfile*.lock
8
+ coverage/
9
+ .ruby-version
10
+ .ruby-gemset
data/.hound.yml ADDED
@@ -0,0 +1,3 @@
1
+ ruby:
2
+ enabled: true
3
+ config_file: .rubocop.yml
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,5 @@
1
+ inherit_from:
2
+ .rubocop_todo.yml
3
+
4
+ Style/StringLiterals:
5
+ Enabled: false
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
@@ -1,4 +1,6 @@
1
- Copyright (c) 2010-2012 Thibaud Guillaume-Gentil
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 [![Build Status](https://secure.travis-ci.org/guard/guard-rspec.png?branch=master)](http://travis-ci.org/guard/guard-rspec)
1
+ # Guard::RSpec
2
2
 
3
- RSpec guard allows to automatically & intelligently launch specs when files are modified.
3
+ [![Gem Version](https://badge.fury.io/rb/guard-rspec.png)](http://badge.fury.io/rb/guard-rspec) [![Build Status](https://secure.travis-ci.org/guard/guard-rspec.png?branch=master)](http://travis-ci.org/guard/guard-rspec) [![Dependency Status](https://gemnasium.com/guard/guard-rspec.png)](https://gemnasium.com/guard/guard-rspec) [![Code Climate](https://codeclimate.com/github/guard/guard-rspec.png)](https://codeclimate.com/github/guard/guard-rspec) [![Coverage Status](https://coveralls.io/repos/guard/guard-rspec/badge.png?branch=master)](https://coveralls.io/r/guard/guard-rspec)
4
4
 
5
- * Compatible with RSpec >= 2.11 (use guard-rspec 1.2.x for older release, including RSpec 1.x)
6
- * Tested against Ruby 1.8.7, 1.9.2, 1.9.3, REE and the latest versions of JRuby & Rubinius.
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
- Please be sure to have [Guard](https://github.com/guard/guard) installed before continue.
12
+ Add the gem to your Gemfile (inside development group):
11
13
 
12
- Install the gem:
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
- $ gem install guard-rspec
21
+ $ bundle exec guard init rspec
16
22
  ```
17
23
 
18
- Add it to your Gemfile (inside development group):
24
+ ## Installing with beta versions of RSpec
19
25
 
20
- ``` ruby
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
- Add guard definition to your Guardfile by running this command:
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
- $ guard init rspec
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 guard can be really adapted to all kind of projects.
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)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
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
- You can pass any of the standard RSpec CLI options using the `:cli` option:
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 'rspec', :cli => "--color --format nested --fail-fast --drb" do
86
+ guard :rspec, cmd: 'spring rspec -f doc' do
73
87
  # ...
74
88
  end
75
89
  ```
76
90
 
77
- By default, Guard::RSpec will only look for spec files within `spec` in your project root. You can configure Guard::RSpec to look in additional paths by using the `:spec_paths` option:
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
- ``` ruby
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
- ``` ruby
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 'rspec', :env => {'RAILS_ENV' => 'guard'} do
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
- :cli => "-c -f doc" # pass arbitrary RSpec CLI arguments, default: "-f progress"
112
- :bundler => false # use "bundle exec" to run the RSpec command, default: true
113
- :binstubs => true # use "bin/rspec" to run the RSpec command (takes precedence over :bundle), default: false
114
- :rvm => ['1.8.7', '1.9.2'] # directly run your specs on multiple Rubies, default: nil
115
- :notification => false # display Growl (or Libnotify) notification after the specs are done running, default: true
116
- :all_after_pass => false # run all specs after changed specs pass, default: true
117
- :all_on_start => false # run all the specs at startup, default: true
118
- :keep_failed => false # keep failed specs until they pass, default: true
119
- :run_all => { :cli => "-p" } # cli arguments to use when running all specs, default: same as :cli
120
- :spec_paths => ["spec"] # specify an array of paths that contain spec files
121
- :turnip => true # enable turnip support; default: false
122
- :zeus => true # enable zeus support; default: false
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
- You can also use a custom binstubs directory using `:binstubs => 'some-dir'`.
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
- The notification feature is only available for RSpec < 2, and RSpec >= 2.4 (due to the multiple-formatters feature that was present in RSpec 1, was removed in RSpec 2 and reintroduced in RSpec 2.4). So if you are using a version between 2 and 2.4, you should disable the notification with <tt>:notification => false</tt>. Otherwise, nothing will be displayed in the terminal when your specs will run.
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
- # in your Gemfile
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
- Default formatter is the `progress` formatter (same as RSpec default).
141
+ ### Zeus Integration
158
142
 
159
- Running a subset of all specs
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
- The `:all_on_start` and `:all_after_pass` options cause all specs located in the `spec` directory to be run. If there
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
- You can also use option :spec_paths to override paths used when running all specs.
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
- ``` ruby
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
- group 'unit-tests' do
178
- guard 'rspec', :spec_paths => ['spec/models', 'spec/controllers', 'spec/routing'] do
179
- # ...
180
- end
181
- end
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
- Development
186
- -----------
171
+ Pull requests are very welcome! Please try to follow these simple rules if applicable:
187
172
 
188
- * Source hosted at [GitHub](https://github.com/guard/guard-rspec)
189
- * Report issues/Questions/Feature requests on [GitHub Issues](https://github.com/guard/guard-rspec/issues)
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
- Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change
192
- you make.
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
- Testing
195
- -------
181
+ ### Author
196
182
 
197
- Please run `rake spec:prepare_fixtures` once before launching specs.
183
+ [Thibaud Guillaume-Gentil](https://github.com/thibaudgg) ([@thibaudgg](https://twitter.com/thibaudgg))
198
184
 
199
- Author
200
- ------
185
+ ### Contributors
201
186
 
202
- [Thibaud Guillaume-Gentil](https://github.com/thibaudgg)
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
@@ -0,0 +1,6 @@
1
+ gemspec path: '../'
2
+
3
+ filename = "gemfiles/common"
4
+ instance_eval(IO.read(filename), filename, 1)
5
+
6
+ gem 'rspec', '~> 2.99'
@@ -0,0 +1,6 @@
1
+ gemspec path: '../'
2
+
3
+ filename = "gemfiles/common"
4
+ instance_eval(IO.read(filename), filename, 1)
5
+
6
+ gem 'rspec', '~> 3.4.0'
data/gemfiles/common ADDED
@@ -0,0 +1,9 @@
1
+ source "https://rubygems.org"
2
+
3
+ group :test do
4
+ gem "bundler", "~> 1.12", "< 2.0"
5
+ gem "rake", "~> 11.1"
6
+ gem 'coveralls', require: false
7
+ gem "launchy", "~> 2.4"
8
+ gem "gem_isolator", '~> 0.2', '>= 0.2.1'
9
+ end
@@ -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