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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04ebab7c57c976985c21b46ab99658f923f4c5b3550616db7c72f66d744b1e47
4
- data.tar.gz: 56d0ca7636fa0efae3931708c88daaf226e766b098f743f7f888c6bb6d92f33b
3
+ metadata.gz: 88fe45587c743f490177b20ef35c1a6372c56b22e631ca8d5bf24fb5836448bc
4
+ data.tar.gz: 23bd0531b2836fb9d3d6d86a462fe65b4f9ddde3b2671db608f1b76fbaf7989b
5
5
  SHA512:
6
- metadata.gz: 0eea269e2f1a8f9a222baf3c707a8a7d418ddc6d2ea39c87da55c07490112e8909efd6f7c71d0ca01630cc6d894e397940c78406c3e206df0010ee90f52c8f75
7
- data.tar.gz: d9080323163091dea28a8977d4b72c505e08e7f14b9c1f973ddf2086abb9d5f852f38e9760e20a6228e07480d99fac63508359a0f61d945452a93b063aa491ff
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.3.1)
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.0)
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 named `.rspec_interactive_config`:
14
-
15
- ```json
16
- {
17
- "configs": [
18
- {
19
- "name": "spec",
20
- "watch_dirs": ["app"],
21
- "init_script": "spec/spec_helper.rb"
22
- },
23
- {
24
- "name": "spec_integration",
25
- "watch_dirs": ["app"],
26
- "init_script": "spec_integration/integration_helper.rb"
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 [spec name]
45
+ bundle exec rspec-interactive spec/rspec_interactive.rb
44
46
  ```
45
47
 
46
48
  ## Example Usage In This Repo
@@ -34,7 +34,9 @@ module RSpec
34
34
  @config_cache = RSpec::Interactive::ConfigCache.new
35
35
 
36
36
  @configuration = Configuration.new
37
- @config_cache.record_configuration { load config_file if config_file }
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
- @on_class_load = proc {}
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)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module Interactive
5
- VERSION = "0.4.0"
5
+ VERSION = "0.5.0"
6
6
  end
7
7
  end
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.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-05-29 00:00:00.000000000 Z
11
+ date: 2021-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-core