rspec-watcher 0.1.0 → 0.2.0

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: 6d56c09fc797e502a6ea38113634a79e2ccdff63d397fa0387b0d6e119daeb3f
4
- data.tar.gz: 2ac174f52116b68c12e78d1aa96697d32deca1dd0137406a22b5cc70398f326a
3
+ metadata.gz: 2559a89ffb1365d4e8a748d96588ba877247e6c8f92c75c5d398ac2ed63a9737
4
+ data.tar.gz: 171d8e6592b10e766069bec16c0fe6deff026bc5c496ade36e1a178284e23379
5
5
  SHA512:
6
- metadata.gz: 21149fae2370cecdb6292e49b2dbc6bce4a6342d48cca8ab58f6f36fe70a58027b0081ca41ad811abc13112195580681c38393ec073e3eb9d409776573b567f5
7
- data.tar.gz: f1b7acc4119b35d3bdb39bc9ac73664d1a838e1dbf036a07fbdddd221c6a85d1c150556a35b94ed3fd48ffa76d32cd0c7552c43f9ae4a1304e54d78ab59b498b
6
+ metadata.gz: ce20eaf946b52b2ac7bdcb80db35b13ae44e1ae51ca3930694b963c75cb5f3488ce83008687b93a4fa065eeae10b199040880415a384a03b19a6843f1a115884
7
+ data.tar.gz: c30e691be2144c2e07c129c83ea46dd94266bc4bdd811a6cbbd7155802d45c81a73e09a2ac64ad36ec1cadf072913fc6b8b5dba47b1f0c6f8e8f7ec548169773
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
- Example configuration for a Rails project in `config/rspec_watcher.rb`:
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
- require Rails.root.join('config/rspec_watcher')
9
+
10
+ config_path = Rails.root.join('config/rspec_watcher')
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RSpecWatcher
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.0'
5
5
  end
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.0
4
+ version: 0.2.0
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