Skip to content

Commit

Permalink
Simplifying the DRb version of the runner so that it works with the t…
Browse files Browse the repository at this point in the history
…estdrb implementation in spork-minitest (not sure what the other one was set up for)
  • Loading branch information
chadoh committed May 1, 2012
1 parent c20bb30 commit 5a7f3c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 74 deletions.
6 changes: 0 additions & 6 deletions lib/guard/minitest/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,6 @@ def minitest_command(paths)
cmd_parts << "bundle exec" if bundler?
if drb?
cmd_parts << 'testdrb'
cmd_parts << "-r #{File.expand_path('../runners/default_runner.rb', __FILE__)}"
cmd_parts << "-e '::GUARD_NOTIFY=#{notify?}'"
test_folders.each do |f|
cmd_parts << "#{f}/test_helper.rb" if File.exist?("#{f}/test_helper.rb")
cmd_parts << "#{f}/spec_helper.rb" if File.exist?("#{f}/spec_helper.rb")
end
cmd_parts += paths.map{|path| "./#{path}" }
else
cmd_parts << 'ruby'
Expand Down
75 changes: 7 additions & 68 deletions spec/guard/minitest/runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,74 +175,13 @@
end

describe 'drb' do
describe 'when using test_helper' do
it 'should run with drb' do
runner = subject.new(:test_folders => %w[test], :drb => true)
Guard::UI.expects(:info)
File.expects(:exist?).with('test/test_helper.rb').returns(true)
File.expects(:exist?).with('test/spec_helper.rb').returns(false)
runner.expects(:system).with(
"testdrb -r #{File.expand_path('.')}/lib/guard/minitest/runners/default_runner.rb -e '::GUARD_NOTIFY=false' test/test_helper.rb ./test/test_minitest.rb"
)
runner.run(['test/test_minitest.rb'], :drb => true)
end

it 'should run with drb and notification disable' do
runner = subject.new(:test_folders => %w[test], :drb => true, :notification => false)
Guard::UI.expects(:info)
File.expects(:exist?).with('test/test_helper.rb').returns(true)
File.expects(:exist?).with('test/spec_helper.rb').returns(false)
runner.expects(:system).with(
"testdrb -r #{File.expand_path('.')}/lib/guard/minitest/runners/default_runner.rb -e '::GUARD_NOTIFY=false' test/test_helper.rb ./test/test_minitest.rb"
)
runner.run(['test/test_minitest.rb'], :drb => true)
end

it 'should run with drb and notification enable' do
runner = subject.new(:test_folders => %w[test], :drb => true, :notification => true)
Guard::UI.expects(:info)
File.expects(:exist?).with('test/test_helper.rb').returns(true)
File.expects(:exist?).with('test/spec_helper.rb').returns(false)
runner.expects(:system).with(
"testdrb -r #{File.expand_path('.')}/lib/guard/minitest/runners/default_runner.rb -e '::GUARD_NOTIFY=true' test/test_helper.rb ./test/test_minitest.rb"
)
runner.run(['test/test_minitest.rb'], :drb => true)
end
end

describe 'when using spec_helper' do
it 'should run with drb' do
runner = subject.new(:test_folders => %w[spec], :drb => true)
Guard::UI.expects(:info)
File.expects(:exist?).with('spec/test_helper.rb').returns(false)
File.expects(:exist?).with('spec/spec_helper.rb').returns(true)
runner.expects(:system).with(
"testdrb -r #{File.expand_path('.')}/lib/guard/minitest/runners/default_runner.rb -e '::GUARD_NOTIFY=false' spec/spec_helper.rb ./test/test_minitest.rb"
)
runner.run(['test/test_minitest.rb'], :drb => true)
end

it 'should run with drb and notification disable' do
runner = subject.new(:test_folders => %w[spec], :drb => true, :notification => false)
Guard::UI.expects(:info)
File.expects(:exist?).with('spec/test_helper.rb').returns(false)
File.expects(:exist?).with('spec/spec_helper.rb').returns(true)
runner.expects(:system).with(
"testdrb -r #{File.expand_path('.')}/lib/guard/minitest/runners/default_runner.rb -e '::GUARD_NOTIFY=false' spec/spec_helper.rb ./test/test_minitest.rb"
)
runner.run(['test/test_minitest.rb'], :drb => true)
end

it 'should run with drb and notification disable' do
runner = subject.new(:test_folders => %w[spec], :drb => true, :notification => true)
Guard::UI.expects(:info)
File.expects(:exist?).with('spec/test_helper.rb').returns(false)
File.expects(:exist?).with('spec/spec_helper.rb').returns(true)
runner.expects(:system).with(
"testdrb -r #{File.expand_path('.')}/lib/guard/minitest/runners/default_runner.rb -e '::GUARD_NOTIFY=true' spec/spec_helper.rb ./test/test_minitest.rb"
)
runner.run(['test/test_minitest.rb'], :drb => true)
end
it 'should run with drb' do
runner = subject.new(:test_folders => %w[test], :drb => true)
Guard::UI.expects(:info)
runner.expects(:system).with(
"testdrb ./test/test_minitest.rb"
)
runner.run(['test/test_minitest.rb'], :drb => true)
end
end
end
Expand Down

0 comments on commit 5a7f3c1

Please sign in to comment.