Skip to content

Commit

Permalink
Merge pull request #117 from singlebrook/dont_run_all_when_test_file_…
Browse files Browse the repository at this point in the history
…missing

Don't run all test files when I save a file with no corresponding test file.
genericsteele committed Aug 24, 2014
2 parents c5cc796 + 7bacc09 commit 726a88c
Showing 2 changed files with 21 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/guard/minitest/runner.rb
Original file line number Diff line number Diff line change
@@ -32,6 +32,8 @@ def initialize(options = {})
end

def run(paths, options = {})
return unless options[:all] || !paths.empty?

message = "Running: #{options[:all] ? 'all tests' : paths.join(' ')}"
UI.info message, reset: true

@@ -44,7 +46,7 @@ def run(paths, options = {})
end

if @options[:all_after_pass] && status && !options[:all]
run_all
run_all
else
status
end
@@ -201,7 +203,7 @@ def generate_includes(include_test_folders = true)
else
folders = include_folders
end

folders.map {|f| %[-I"#{f}"] }
end

18 changes: 17 additions & 1 deletion spec/lib/guard/minitest/runner_spec.rb
Original file line number Diff line number Diff line change
@@ -446,10 +446,26 @@
runner.expects(:system).with(
"testdrb -I\"lib\" -I\"app\" ./test/test_minitest.rb"
)

runner.run(['test/test_minitest.rb'])
end
end

describe 'when no paths are passed' do
let(:runner) { subject.new }

it 'does not run a command' do
runner.expects(:_run_command).never

runner.run([])
end

it 'still runs all if requested' do
runner.expects(:_run_command).once.with([], true).returns(true)

runner.run([], all: true).must_equal true
end
end
end

describe 'run_all' do

0 comments on commit 726a88c

Please sign in to comment.