rspec-daemon 1.0.1 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89e342dbe33448b2a4321d6425f22924ef2e2ffca0da9c62b9b9dfe85b30df24
4
- data.tar.gz: c73ef7dc9be41b613ab443f9c3bde415afe4689bf4114bbb98fc137429b7128c
3
+ metadata.gz: b794e2ebe6daea0da87095807caba45548cb4edb10fff720edec6dc2fad7b785
4
+ data.tar.gz: 7305ea8cc68079c84193e1ef7426a4e906536dbdad7d5682a2cf457b1899e4b6
5
5
  SHA512:
6
- metadata.gz: b40f70439941100811fbcf34906e077be7d8172399ecd5a046b0815dbc3ec786a87b280a6332a97dced543d4a65e13ad924b93f902ed524f9eb700ff5bea2c1a
7
- data.tar.gz: 5951972b8a86979b652a757a0ca36f41daee408728e512125230c02ee90a73088f1dd2fb064f89540fe8724ff3754ef04ce416e47b8cc7a1b3730c3525e22f6b
6
+ metadata.gz: '099cba4faec97b361236d9ba8ac9c46b160b0e9c676ef631f51fac6d541e3c9a08678385c440daf5832fce54470dd3ec47226ba56e1ddcf923a7e14fe42cd98f'
7
+ data.tar.gz: 9ab4e6d62df9c149791ccf898634e4cbdec3d06e066d8624e33a320f36d7f2d19fdbc41169d1507e50a36a1ca9f72435d0a1390bf464adb6ee511b7a4345376b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [1.1.1] - 2023-12-18
2
+
3
+ - Compatibility update for rspec-daemon with Rails < 7.0 #12 @asonas w/ @osyoyu
4
+
5
+ ## [1.1.0] - 2023-12-16
6
+
7
+ - Rails: Invoke autoreloading on every run #11 @osyoyu
8
+
1
9
  ## [1.0.1] - 2023-12-16
2
10
 
3
11
  - Fix the method to start the test #9 @ta1kt0me
data/README.md CHANGED
@@ -43,6 +43,29 @@ $ 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
+ For Rails earlier than 7.0
59
+
60
+ ```
61
+ if Rails.env.test? && ENV['RSPEC_DAEMON']
62
+ Rails.configuration.cache_classes = true
63
+ end
64
+ ```
65
+
66
+ If autoreloading is not configured, you'd need to restart `rspec-daemon` every time you change code under `app/`.
67
+ Spec code (under `spec/`) will be always reloaded regardless of this setting.
68
+
46
69
  ## Editor integration
47
70
 
48
71
  ### Vim/Neovim
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  class Daemon
5
- VERSION = "1.0.1"
5
+ VERSION = "1.1.1"
6
6
  end
7
7
  end
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 (if Rails is in Zeitwerk mode and autoloading is enabled)
70
+ if defined?(::Rails) && Rails.respond_to?(:autoloaders) && !::Rails.configuration.cache_classes?
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
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-daemon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuya Fujiwara
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-15 00:00:00.000000000 Z
11
+ date: 2023-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -74,7 +74,7 @@ metadata:
74
74
  homepage_uri: https://github.com/asonas/rspec-daemon
75
75
  source_code_uri: https://github.com/asonas/rspec-daemon
76
76
  changelog_uri: https://github.com/asonas/rspec-daemon/blob/master/CHANGELOG.md
77
- post_install_message:
77
+ post_install_message:
78
78
  rdoc_options: []
79
79
  require_paths:
80
80
  - lib
@@ -89,8 +89,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  requirements: []
92
- rubygems_version: 3.4.10
93
- signing_key:
92
+ rubygems_version: 3.4.6
93
+ signing_key:
94
94
  specification_version: 4
95
95
  summary: rspec-daemon is a mechanism to run tests at super faster speed
96
96
  test_files: []