rspec-daemon 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +15 -0
- data/lib/rspec/daemon/version.rb +1 -1
- data/lib/rspec/daemon.rb +8 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34268638889a4b7657ec87ecf13fe579c32c79753c5299fdd8f62dab0a31703f
|
4
|
+
data.tar.gz: 19cccfc47d8a9e0f03f04d80fa6f355d62ebf39dcaadc2d15113cfa68ffc8e38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b770f2cfb61e332e9e2e672dd97fac2a33bf1386d28d5300a02daffb8e332d65adadacfa25016cf1b743a6ab6eeed46f66a6d752e524eb763abedf49348d635
|
7
|
+
data.tar.gz: '01877ce39e845297adc62697f00894b2b7de0dfd8e685cae1b17bbd31b4783549e45694e4e52bb944310c48cf5deb23eca9e22b6534bfcef26dfa7af94164a99'
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -43,6 +43,21 @@ $ echo 'spec/models/user_spec.rb' | nc -v 0.0.0.0 3002
|
|
43
43
|
|
44
44
|
By default, `rspec-daemon` will run on port `3002`. You can adjust the port by passing `--port` to `rspec-daemon` or setting the `RSPEC_DAEMON_PORT` environment variable.
|
45
45
|
|
46
|
+
### Auto-reloading application code in Rails
|
47
|
+
|
48
|
+
If properly configured, rspec-daemon will automatically reload your application code (you probably want this behavior).
|
49
|
+
Add the following code to `config/initializers/rspec_daemon.rb`:
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
# rspec-daemon exposes RSPEC_DAEMON=1
|
53
|
+
if Rails.env.test? && ENV['RSPEC_DAEMON']
|
54
|
+
Rails.configuration.enable_reloading = true
|
55
|
+
end
|
56
|
+
```
|
57
|
+
|
58
|
+
If autoreloading is not configured, you'd need to restart `rspec-daemon` every time you change code under `app/`.
|
59
|
+
Spec code (under `spec/`) will be always reloaded regardless of this setting.
|
60
|
+
|
46
61
|
## Editor integration
|
47
62
|
|
48
63
|
### Vim/Neovim
|
data/lib/rspec/daemon/version.rb
CHANGED
data/lib/rspec/daemon.rb
CHANGED
@@ -64,14 +64,22 @@ module RSpec
|
|
64
64
|
RSpec.reset
|
65
65
|
|
66
66
|
if cached_config.has_recorded_config?
|
67
|
+
# Reload configuration from the first time
|
67
68
|
cached_config.replay_configuration
|
69
|
+
# Invoke auto reload
|
70
|
+
if defined?(::Rails) && ::Rails.configuration.reloading_enabled?
|
71
|
+
puts "Reloading..."
|
72
|
+
::Rails.autoloaders.main.reload
|
73
|
+
end
|
68
74
|
else
|
75
|
+
# This is the first spec run
|
69
76
|
cached_config.record_configuration(&rspec_configuration)
|
70
77
|
end
|
71
78
|
end
|
72
79
|
|
73
80
|
def rspec_configuration
|
74
81
|
proc do
|
82
|
+
ENV['RSPEC_DAEMON'] = "1"
|
75
83
|
if File.exist? "spec/rails_helper.rb"
|
76
84
|
require "rails_helper"
|
77
85
|
end
|