Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Change Log

## 1.3.0

- Add hack to handle subsequent invocations using spec runners by stripping strings 'bundle', 'exec', 'rspec-preloader', 'rspec'
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Restart your server each time you commit (see the How it works session to find o


rspec-preloader will pass your input to rspec as is, so you can use any input rspec would accept, including specific line numbers or formatting options.
Only files from `app/` and `lib/` will be reloaded. If you modify spec helpers or spec support files, you should probably restart the preloader.
Only files from `app/`, `lib/`, `apps/` and `config/` will be reloaded. If you modify spec helpers or spec support files, you should probably restart the preloader.

How it works
---
Expand All @@ -60,7 +60,7 @@ This is what happens under the hood :
- fork a process and run the tests in that process
- wait for the next command
- fork
- find which ruby files in `app/` and `lib/` have been modified using git
- find which ruby files in `app/`, `lib/`, `apps/` and `config/` have been modified using git
- load them
- run rspec in the forked process with the given input
- start over
Expand All @@ -78,4 +78,3 @@ Contributing
Contributions welcome! Just fork it and send a pull request.

This gem is under the MIT license by the way.

2 changes: 1 addition & 1 deletion lib/rspec_preloader/file_selector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def self.updated_source_files

def updated_source_files
all_updated_files.select do |filename|
filename.start_with?('app/') || filename.start_with?('lib/')
filename.start_with?('app/', 'lib/', 'apps/', 'config/')
end.select do |filename|
filename.end_with?('.rb')
end
Expand Down
2 changes: 2 additions & 0 deletions lib/rspec_preloader/spec_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def load_updated_files
end

def run_specs(arguments_array)
# NOTE: Hack to allow subsequent spec runner invocations to work
arguments_array.reject! { |arg| ['bundle', 'exec', 'rspec-preloader', 'rspec'].include?(arg) }
RSpec::Core::Runner.run(arguments_array, @std_err, @std_out)
end

Expand Down
2 changes: 1 addition & 1 deletion rspec_preloader.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |gem|
gem.name = 'rspec-preloader'
gem.version = '1.1.0'
gem.version = '1.3.0'
gem.licenses = ['MIT']
gem.summary = "Start Rspec instantly"
gem.description = "Life is too short to be waiting for your tests to load."
Expand Down