rspec-interactive 0.4.0 → 0.5.0
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 +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +20 -18
- data/lib/rspec-interactive.rb +3 -1
- data/lib/rspec-interactive/config.rb +9 -3
- data/lib/rspec-interactive/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88fe45587c743f490177b20ef35c1a6372c56b22e631ca8d5bf24fb5836448bc
|
4
|
+
data.tar.gz: 23bd0531b2836fb9d3d6d86a462fe65b4f9ddde3b2671db608f1b76fbaf7989b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a066316a818ebaf46096e655d5e20c87280ae47863aeae564e275b066647b004afad528e40e0cc4dbe56935f6bd3c9275541302893b2fbd77c2eb01c84cdbf9c
|
7
|
+
data.tar.gz: 45d608d8bf7524a575bf833be24bcd13ec3ea6d2612da9ef40d7da5f9366fb43474eb078ab56c88f61c45d67143515a140d9d8de094e418906895cb277393386
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rspec-interactive (0.
|
4
|
+
rspec-interactive (0.5.0)
|
5
5
|
listen
|
6
6
|
pry
|
7
7
|
rspec-core
|
@@ -11,7 +11,7 @@ GEM
|
|
11
11
|
specs:
|
12
12
|
coderay (1.1.3)
|
13
13
|
diff-lcs (1.4.4)
|
14
|
-
ffi (1.15.
|
14
|
+
ffi (1.15.3)
|
15
15
|
listen (3.5.1)
|
16
16
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
17
17
|
rb-inotify (~> 0.9, >= 0.9.10)
|
data/README.md
CHANGED
@@ -10,23 +10,25 @@ Install:
|
|
10
10
|
gem 'rspec-interactive'
|
11
11
|
```
|
12
12
|
|
13
|
-
Add a config file
|
14
|
-
|
15
|
-
```
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
13
|
+
Add a config file which configures RSpec and RSpec::Interactive, for example `spec/rspec_interactive.rb`:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
load 'spec/spec_helper.rb'
|
17
|
+
|
18
|
+
RSpec::Interactive.configure do |config|
|
19
|
+
# Directories to watch for file changes. When a file changes, it will be reloaded like `load 'path/to/file'`.
|
20
|
+
config.watch_dirs += ["app", "lib", "config"]
|
21
|
+
|
22
|
+
# This block is invoked on startup. RSpec configuration must happen here so that it can be reloaded before each test run.
|
23
|
+
config.configure_rspec do
|
24
|
+
require './spec/spec_helper.rb'
|
25
|
+
end
|
26
|
+
|
27
|
+
# Invoked whenever a class is loaded due to a file change in one of the watch_dirs.
|
28
|
+
config.on_class_load do |clazz|
|
29
|
+
clazz.clear_validators! if clazz < ApplicationRecord
|
30
|
+
end
|
31
|
+
end
|
30
32
|
```
|
31
33
|
|
32
34
|
Update `.gitignore`
|
@@ -40,7 +42,7 @@ echo '.rspec_interactive_history' >> .gitignore
|
|
40
42
|
See more examples below.
|
41
43
|
|
42
44
|
```shell
|
43
|
-
bundle exec rspec-interactive
|
45
|
+
bundle exec rspec-interactive spec/rspec_interactive.rb
|
44
46
|
```
|
45
47
|
|
46
48
|
## Example Usage In This Repo
|
data/lib/rspec-interactive.rb
CHANGED
@@ -34,7 +34,9 @@ module RSpec
|
|
34
34
|
@config_cache = RSpec::Interactive::ConfigCache.new
|
35
35
|
|
36
36
|
@configuration = Configuration.new
|
37
|
-
|
37
|
+
load config_file if config_file
|
38
|
+
|
39
|
+
@config_cache.record_configuration { @configuration.configure_rspec.call }
|
38
40
|
|
39
41
|
check_rails
|
40
42
|
start_file_watcher
|
@@ -1,11 +1,17 @@
|
|
1
1
|
module RSpec
|
2
2
|
module Interactive
|
3
3
|
class Configuration
|
4
|
-
attr_accessor :watch_dirs, :on_class_load
|
4
|
+
attr_accessor :watch_dirs, :configure_rspec, :on_class_load
|
5
5
|
|
6
6
|
def initialize
|
7
|
-
@watch_dirs
|
8
|
-
@
|
7
|
+
@watch_dirs = []
|
8
|
+
@configure_rspec = proc {}
|
9
|
+
@on_class_load = proc {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def configure_rspec(&block)
|
13
|
+
return @configure_rspec unless block
|
14
|
+
@configure_rspec = block
|
9
15
|
end
|
10
16
|
|
11
17
|
def on_class_load(&block)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-interactive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Dower
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-core
|