guard-rspec 4.6.0 → 4.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -0
- data/lib/guard/rspec/runner.rb +3 -1
- data/lib/guard/rspec/version.rb +1 -1
- data/lib/guard/rspec_defaults.rb +5 -0
- data/lib/guard/rspec_formatter.rb +14 -1
- data/spec/lib/guard/rspec_formatter_spec.rb +29 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6f8f0ec11addb557bcea8e0b4e67b2f53bc9fc0
|
4
|
+
data.tar.gz: 72f89cda0c8952689eac3466d5450e458d3ecbde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f87137e2042acd5bd024d0d094c020411dc55c9b68c7edec9b87c8fb7f5238445af78f65e0041653137d6e6187e1f1d74b4eb13066b687129258a1d18dc5c934
|
7
|
+
data.tar.gz: 9d6b60cdb428ac5f33a0a8ebdc12d33f053bfb2184c6c56200d18cc48137aab79e28ce3fddf5ed2913efaca45c00249fa80e4f942c9a45569b8f5bec34ac1de3
|
data/README.md
CHANGED
@@ -109,6 +109,33 @@ guard :rspec, cmd: 'rspec -f html -o ./tmp/spec_results.html', launchy: './tmp/s
|
|
109
109
|
end
|
110
110
|
```
|
111
111
|
|
112
|
+
### Integration with Zeus
|
113
|
+
|
114
|
+
First, know that Guard::Zeus also generates a Guardfile template with RSpec commands - if you prefer Guard::RSpec, you may want to keep Guard::Zeus, but without the RSpec running commands (so you can manage the Guard::Zeus server instead of running it manually).
|
115
|
+
|
116
|
+
Second, since Guard::RSpec 4.6.x, the output file name is passed using environment variables - but Zeus doesn't pass these when rerunning tests, so you get this error: #334
|
117
|
+
|
118
|
+
The workaround is to create a custom Zeus plan:
|
119
|
+
|
120
|
+
1. `zeus init`
|
121
|
+
2. edit `custom_plan.rb` to contain the following:
|
122
|
+
|
123
|
+
```ruby
|
124
|
+
require 'zeus/rails'
|
125
|
+
|
126
|
+
class CustomPlan < Zeus::Rails
|
127
|
+
def test(*args)
|
128
|
+
ENV['GUARD_RSPEC_RESULTS_FILE'] = 'tmp/guard_rspec_results.txt' # Guard::RSpec::Runner::TEMPORARY_FILE_PATH
|
129
|
+
super
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
Zeus.plan = CustomPlan.new
|
134
|
+
```
|
135
|
+
|
136
|
+
And that's it. (I'd like things to work without this, but I don't know how.)
|
137
|
+
|
138
|
+
|
112
139
|
### Using parallel_tests
|
113
140
|
|
114
141
|
parallel_tests has a `-o` option for passing RSpec options, and here's a trick to make it work with Guard::RSpec:
|
data/lib/guard/rspec/runner.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "guard/rspec_defaults"
|
2
|
+
|
1
3
|
require "guard/rspec/inspectors/factory"
|
2
4
|
require "guard/rspec/command"
|
3
5
|
require "guard/rspec/notifier"
|
@@ -80,7 +82,7 @@ module Guard
|
|
80
82
|
end
|
81
83
|
|
82
84
|
def _results_file(results_file, chdir)
|
83
|
-
results_file ||= TEMPORARY_FILE_PATH
|
85
|
+
results_file ||= RSpecDefaults::TEMPORARY_FILE_PATH
|
84
86
|
return results_file unless Pathname(results_file).relative?
|
85
87
|
chdir ? File.join(chdir, results_file) : results_file
|
86
88
|
end
|
data/lib/guard/rspec/version.rb
CHANGED
@@ -7,8 +7,16 @@ require "fileutils"
|
|
7
7
|
require "rspec"
|
8
8
|
require "rspec/core/formatters/base_formatter"
|
9
9
|
|
10
|
+
require "guard/rspec_defaults"
|
11
|
+
|
10
12
|
module Guard
|
11
13
|
class RSpecFormatter < ::RSpec::Core::Formatters::BaseFormatter
|
14
|
+
WIKI_ENV_WARN_URL =
|
15
|
+
"https://github.com/guard/guard-rspec/wiki/Warning:-no-environment"
|
16
|
+
|
17
|
+
NO_ENV_WARNING_MSG = "no environment passed - see #{WIKI_ENV_WARN_URL}"
|
18
|
+
NO_RESULTS_VALUE_MSG = ":results_file value unknown (using defaults)"
|
19
|
+
|
12
20
|
def self.rspec_3?
|
13
21
|
::RSpec::Core::Version::STRING.split(".").first == "3"
|
14
22
|
end
|
@@ -110,7 +118,12 @@ module Guard
|
|
110
118
|
|
111
119
|
def _results_file
|
112
120
|
path = ENV["GUARD_RSPEC_RESULTS_FILE"]
|
113
|
-
|
121
|
+
if path.nil?
|
122
|
+
STDERR.puts "Guard::RSpec: Warning: #{NO_ENV_WARNING_MSG}\n" \
|
123
|
+
"Guard::RSpec: Warning: #{NO_RESULTS_VALUE_MSG}"
|
124
|
+
path = RSpecDefaults::TEMPORARY_FILE_PATH
|
125
|
+
end
|
126
|
+
|
114
127
|
File.expand_path(path)
|
115
128
|
end
|
116
129
|
end
|
@@ -86,6 +86,35 @@ RSpec.describe Guard::RSpecFormatter do
|
|
86
86
|
end.to raise_error(TypeError, "foo")
|
87
87
|
end
|
88
88
|
end
|
89
|
+
|
90
|
+
context "when no env is passed" do
|
91
|
+
let(:file) { File.join(Dir.pwd, "tmp/rspec_guard_result") }
|
92
|
+
|
93
|
+
before do
|
94
|
+
ENV["GUARD_RSPEC_RESULTS_FILE"] = nil
|
95
|
+
|
96
|
+
allow(FileUtils).to receive(:mkdir_p).
|
97
|
+
with(File.dirname(file)) {}
|
98
|
+
|
99
|
+
allow(File).to receive(:open).
|
100
|
+
with(file, "w") do |_, _, &block|
|
101
|
+
block.call writer
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
it "warns" do
|
106
|
+
expect(STDERR).to receive(:puts).with(/no environment/)
|
107
|
+
formatter.dump_summary(*example_dump_summary_args)
|
108
|
+
end
|
109
|
+
|
110
|
+
it "uses default file" do
|
111
|
+
expect(File).to receive(:open).
|
112
|
+
with(file, "w") do |_, _, &block|
|
113
|
+
block.call writer
|
114
|
+
end
|
115
|
+
formatter.dump_summary(*example_dump_summary_args)
|
116
|
+
end
|
117
|
+
end
|
89
118
|
end
|
90
119
|
|
91
120
|
context "with failures" do
|
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.1
|
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: 2015-
|
11
|
+
date: 2015-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|
@@ -144,6 +144,7 @@ files:
|
|
144
144
|
- lib/guard/rspec/runner.rb
|
145
145
|
- lib/guard/rspec/templates/Guardfile
|
146
146
|
- lib/guard/rspec/version.rb
|
147
|
+
- lib/guard/rspec_defaults.rb
|
147
148
|
- lib/guard/rspec_formatter.rb
|
148
149
|
- spec/lib/guard/rspec/command_spec.rb
|
149
150
|
- spec/lib/guard/rspec/deprecator_spec.rb
|
@@ -181,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
182
|
version: '0'
|
182
183
|
requirements: []
|
183
184
|
rubyforge_project:
|
184
|
-
rubygems_version: 2.4.
|
185
|
+
rubygems_version: 2.4.5
|
185
186
|
signing_key:
|
186
187
|
specification_version: 4
|
187
188
|
summary: Guard gem for RSpec
|