guard-rspec 4.7.1 → 4.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -7
- data/README.md +5 -0
- data/lib/guard/rspec/options.rb +2 -1
- data/lib/guard/rspec/rspec_process.rb +10 -6
- data/lib/guard/rspec/runner.rb +1 -1
- data/lib/guard/rspec/version.rb +1 -1
- data/spec/lib/guard/rspec/rspec_process_spec.rb +28 -0
- data/spec/lib/guard/rspec/runner_spec.rb +8 -7
- 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: 918301c5591d32e57f968b46fe945cf4e5f6871d
|
4
|
+
data.tar.gz: 416877bc8284de1e6c44d200c2be36625dfc6829
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7e36a93775573a76d509da8ed55307f0af64f8b6029bc04bbe8aff657d76731516f22fa1b371a3a5facadef0649181d661e0243bbb6de9d484eb8b03665de58
|
7
|
+
data.tar.gz: 5456241016e2fb4596f81bd17b26465e8e6457aa62aee18e227b47682b66e9c7ee79be30a23968fbd0979e53686e1ad32834f0ddf958ab7322a14018eccfa578
|
data/Gemfile
CHANGED
@@ -15,10 +15,7 @@ else
|
|
15
15
|
gemspec development_group: :gem_build_tools
|
16
16
|
end
|
17
17
|
|
18
|
-
# bundler + rake - always included
|
19
18
|
group :gem_build_tools do
|
20
|
-
gem "bundler", "~> 1.12", "< 2.0"
|
21
|
-
gem "rake", "~> 11.1"
|
22
19
|
end
|
23
20
|
|
24
21
|
group :development do
|
@@ -26,7 +23,3 @@ group :development do
|
|
26
23
|
gem "guard-rubocop", require: false
|
27
24
|
gem "guard-compat", ">= 0.0.2", require: false
|
28
25
|
end
|
29
|
-
|
30
|
-
group :tool do
|
31
|
-
gem "ruby_gntp", require: false
|
32
|
-
end
|
data/README.md
CHANGED
@@ -120,6 +120,11 @@ run_all: { cmd: 'custom rspec command', message: 'custom message' } # Custom opt
|
|
120
120
|
title: 'My project' # Display a custom title for the notification, default: 'RSpec results'
|
121
121
|
chdir: 'directory' # run rspec from within a given subdirectory (useful if project has separate specs for submodules)
|
122
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
130
|
### Using Launchy to view rspec results
|
data/lib/guard/rspec/options.rb
CHANGED
@@ -6,12 +6,13 @@ module Guard
|
|
6
6
|
class Failure < RuntimeError
|
7
7
|
end
|
8
8
|
|
9
|
-
attr_reader :results
|
9
|
+
attr_reader :results, :options
|
10
10
|
|
11
|
-
def initialize(command, formatter_tmp_file)
|
11
|
+
def initialize(command, formatter_tmp_file, options = {})
|
12
12
|
@command = command
|
13
13
|
@formatter_tmp_file = formatter_tmp_file
|
14
14
|
@results = nil
|
15
|
+
@options = options
|
15
16
|
|
16
17
|
@exit_code = _run
|
17
18
|
@results = _read_results
|
@@ -24,7 +25,7 @@ module Guard
|
|
24
25
|
private
|
25
26
|
|
26
27
|
def _run
|
27
|
-
|
28
|
+
_with_desired_bundler_env do
|
28
29
|
exit_code = _really_run
|
29
30
|
|
30
31
|
msg = "Guard::RSpec: RSpec command %s exited with: %s"
|
@@ -65,11 +66,14 @@ module Guard
|
|
65
66
|
File.delete(formatter_tmp_file) if File.exist?(formatter_tmp_file)
|
66
67
|
end
|
67
68
|
|
68
|
-
def
|
69
|
-
|
69
|
+
def _with_desired_bundler_env
|
70
|
+
desired_bundler_env = options[:bundler_env]
|
71
|
+
if !defined?(::Bundler) || desired_bundler_env == :inherit
|
72
|
+
yield
|
73
|
+
elsif desired_bundler_env == :clean_env
|
70
74
|
::Bundler.with_clean_env { yield }
|
71
75
|
else
|
72
|
-
yield
|
76
|
+
::Bundler.with_original_env { yield }
|
73
77
|
end
|
74
78
|
end
|
75
79
|
|
data/lib/guard/rspec/runner.rb
CHANGED
@@ -62,7 +62,7 @@ module Guard
|
|
62
62
|
# TODO: add option to specify the file
|
63
63
|
file = _results_file(options[:results_file], options[:chdir])
|
64
64
|
|
65
|
-
process = RSpecProcess.new(cmd, file)
|
65
|
+
process = RSpecProcess.new(cmd, file, options)
|
66
66
|
results = process.results
|
67
67
|
|
68
68
|
inspector.failed(results.failed_paths)
|
data/lib/guard/rspec/version.rb
CHANGED
@@ -111,5 +111,33 @@ RSpec.describe Guard::RSpec::RSpecProcess do
|
|
111
111
|
end
|
112
112
|
end
|
113
113
|
end
|
114
|
+
|
115
|
+
context "with bundler_env option" do
|
116
|
+
it "runs without Bunder changes when :inherit" do
|
117
|
+
expect(Bundler).to_not receive(:with_clean_env)
|
118
|
+
expect(Bundler).to_not receive(:with_original_env)
|
119
|
+
|
120
|
+
described_class.new(cmd, file, bundler_env: :inherit)
|
121
|
+
end
|
122
|
+
|
123
|
+
it "runs on clean Bunder changes when :clean_env" do
|
124
|
+
expect(Bundler).to receive(:with_clean_env)
|
125
|
+
|
126
|
+
described_class.new(cmd, file, bundler_env: :clean_env)
|
127
|
+
end
|
128
|
+
|
129
|
+
it "runs on original Bunder changes when :original_env" do
|
130
|
+
expect(Bundler).to receive(:with_original_env)
|
131
|
+
|
132
|
+
described_class.new(cmd, file, bundler_env: :original_env)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
context "without bundler_env option" do
|
137
|
+
it "runs on original Bunder" do
|
138
|
+
expect(Bundler).to receive(:with_original_env)
|
139
|
+
subject
|
140
|
+
end
|
141
|
+
end
|
114
142
|
end
|
115
143
|
end
|
@@ -218,7 +218,7 @@ RSpec.describe Guard::RSpec::Runner do
|
|
218
218
|
let(:results_file) { File.join(Dir.pwd, "foobar.txt") }
|
219
219
|
it "uses the given file" do
|
220
220
|
expect(Guard::RSpec::RSpecProcess).to receive(:new).
|
221
|
-
with(anything, results_file).and_return(process)
|
221
|
+
with(anything, results_file, options).and_return(process)
|
222
222
|
runner.run(paths)
|
223
223
|
end
|
224
224
|
end
|
@@ -227,7 +227,7 @@ RSpec.describe Guard::RSpec::Runner do
|
|
227
227
|
let(:results_file) { "/foo/foobar.txt" }
|
228
228
|
it "uses the given path" do
|
229
229
|
expect(Guard::RSpec::RSpecProcess).to receive(:new).
|
230
|
-
with(anything, results_file).and_return(process)
|
230
|
+
with(anything, results_file, options).and_return(process)
|
231
231
|
runner.run(paths)
|
232
232
|
end
|
233
233
|
end
|
@@ -243,7 +243,7 @@ RSpec.describe Guard::RSpec::Runner do
|
|
243
243
|
it "uses a path relative to chdir" do
|
244
244
|
expected = "/foo/bar/moduleA/foobar.txt"
|
245
245
|
expect(Guard::RSpec::RSpecProcess).to receive(:new).
|
246
|
-
with(anything, expected).and_return(process)
|
246
|
+
with(anything, expected, options).and_return(process)
|
247
247
|
runner.run(paths)
|
248
248
|
end
|
249
249
|
end
|
@@ -252,7 +252,7 @@ RSpec.describe Guard::RSpec::Runner do
|
|
252
252
|
let(:results_file) { "/foo/foobar.txt" }
|
253
253
|
it "uses the full given path anyway" do
|
254
254
|
expect(Guard::RSpec::RSpecProcess).to receive(:new).
|
255
|
-
with(anything, results_file).and_return(process)
|
255
|
+
with(anything, results_file, options).and_return(process)
|
256
256
|
runner.run(paths)
|
257
257
|
end
|
258
258
|
end
|
@@ -270,7 +270,7 @@ RSpec.describe Guard::RSpec::Runner do
|
|
270
270
|
it "uses a path relative to chdir" do
|
271
271
|
expected = File.join(Dir.pwd, "moduleA/foobar.txt")
|
272
272
|
expect(Guard::RSpec::RSpecProcess).to receive(:new).
|
273
|
-
with(anything, expected).and_return(process)
|
273
|
+
with(anything, expected, options).and_return(process)
|
274
274
|
runner.run(paths)
|
275
275
|
end
|
276
276
|
|
@@ -285,7 +285,7 @@ RSpec.describe Guard::RSpec::Runner do
|
|
285
285
|
let(:results_file) { "/foo/foobar.txt" }
|
286
286
|
it "uses the full given path anyway" do
|
287
287
|
expect(Guard::RSpec::RSpecProcess).to receive(:new).
|
288
|
-
with(anything, results_file).and_return(process)
|
288
|
+
with(anything, results_file, options).and_return(process)
|
289
289
|
runner.run(paths)
|
290
290
|
end
|
291
291
|
end
|
@@ -296,8 +296,9 @@ RSpec.describe Guard::RSpec::Runner do
|
|
296
296
|
context "with no custom results file" do
|
297
297
|
let(:options) { { cmd: "rspec" } }
|
298
298
|
it "uses the default" do
|
299
|
+
expected_params = [anything, %r{/tmp/rspec_guard_result$}, options]
|
299
300
|
expect(Guard::RSpec::RSpecProcess).to receive(:new).
|
300
|
-
with(
|
301
|
+
with(*expected_params).and_return(process)
|
301
302
|
runner.run(paths)
|
302
303
|
end
|
303
304
|
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.7.
|
4
|
+
version: 4.7.2
|
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: 2016-
|
11
|
+
date: 2016-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|