rspec-watcher 0.1.0 → 0.2.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 +6 -6
- data/lib/rspec_watcher/default_configuration.rb +23 -0
- data/lib/rspec_watcher/tasks/watch.rake +7 -1
- data/lib/rspec_watcher/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9a41ee072bb0c0c9e649e1a1513709ae253e08b8c8032079eed9b59e87f3261
|
4
|
+
data.tar.gz: e405302ba9cdfab0e69f2a0805b2ede9f34df5f5eac4ef3591c210acb317137e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de7843b4b6b91c445d1382269d93cdca4f22b1bf053a0c5bf73dbfdcf3ec799e525a560c1488d4dfca5f3a4a7cc9c2bbc0a8ff7e60b6f45a8b9a9f36cb2762c2
|
7
|
+
data.tar.gz: 1293ed84837d6c56a09a1d04577e8444699f5c2098a4544a0d80e9a77349d47e80238680d55b338b3a86060b4d3a4e9cc5240a8bac9b95497a08ee480b2ae67a
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# RspecWatcher
|
2
2
|
|
3
|
-
Automatically runs specs in reaction to changes in files. Loads the project once and uses code reloading to get changes instead of starting a new process for every test run.
|
3
|
+
Automatically runs specs in reaction to changes in files. Loads the project once and uses code reloading to get changes instead of starting a new process for every test run. Needs to be restarted after changes to files that do not get reloaded.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -14,7 +14,11 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
14
14
|
|
15
15
|
## Usage
|
16
16
|
|
17
|
-
|
17
|
+
Start the watcher with `RAILS_ENV=test bundle exec rake rspec_watcher:watch`
|
18
|
+
|
19
|
+
In order to use the watcher without Rails, `path_inferrer` and `reloader` need to be configured. Check `lib/rspec_watcher.rb`. The rake task also assumes usage inside a Rails project.
|
20
|
+
|
21
|
+
Configuration can be specified in `config/rspec_watcher.rb`, this is the default:
|
18
22
|
|
19
23
|
```ruby
|
20
24
|
RSpecWatcher.configure do
|
@@ -40,10 +44,6 @@ RSpecWatcher.configure do
|
|
40
44
|
end
|
41
45
|
```
|
42
46
|
|
43
|
-
Start the watcher with `RAILS_ENV=test bundle exec rake rspec_watcher:watch`
|
44
|
-
|
45
|
-
In order to use trhe watcher without Rails, `path_inferrer` and `reloader` need to be configured. Check `lib/rspec_watcher.rb`
|
46
|
-
|
47
47
|
## Development
|
48
48
|
|
49
49
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpecWatcher.configure do
|
4
|
+
watch 'spec', only: /_spec\.rb\z/ do |modified, added, _removed|
|
5
|
+
modified + added
|
6
|
+
end
|
7
|
+
|
8
|
+
watch 'spec', ignore: /_spec\.rb\z/
|
9
|
+
|
10
|
+
watch 'app', only: /\.rb\z/, ignore: %r{controllers/} do |modified, added, removed|
|
11
|
+
(modified + added + removed).map do |path|
|
12
|
+
path.sub('app/', 'spec/').sub('.rb', '_spec.rb')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
watch 'app/controllers', only: /\.rb\z/ do |modified, added, removed|
|
17
|
+
(modified + added + removed).map do |path|
|
18
|
+
path.sub('app/', 'spec/').sub('controllers/', 'requests/').sub('_controller.rb', '_spec.rb')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
watch 'config', only: /routes\.rb\z/
|
23
|
+
end
|
@@ -6,7 +6,13 @@ namespace :rspec_watcher do
|
|
6
6
|
abort('Not running in test environment') unless Rails.env.test?
|
7
7
|
|
8
8
|
require 'rspec/core'
|
9
|
-
|
9
|
+
|
10
|
+
config_path = Rails.root.join('config/rspec_watcher').to_s
|
11
|
+
if File.exist?(config_path)
|
12
|
+
require config_path
|
13
|
+
else
|
14
|
+
require_relative '../default_configuration'
|
15
|
+
end
|
10
16
|
|
11
17
|
RSpecWatcher.start
|
12
18
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-watcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matous Vokal
|
@@ -38,6 +38,7 @@ files:
|
|
38
38
|
- README.md
|
39
39
|
- Rakefile
|
40
40
|
- lib/rspec-watcher.rb
|
41
|
+
- lib/rspec_watcher/default_configuration.rb
|
41
42
|
- lib/rspec_watcher/railtie.rb
|
42
43
|
- lib/rspec_watcher/tasks/watch.rake
|
43
44
|
- lib/rspec_watcher/version.rb
|