Permalink
Browse files

Allow to run over a custom port

  • Loading branch information...
1 parent 8fc5be8 commit 4e6ed5121ad24aad8c82de249639eb049f0a1d33 @semaperepelitsa committed Apr 30, 2012
Showing with 7 additions and 2 deletions.
  1. +3 −1 Readme.md
  2. +4 −1 bin/testdrb
View
@@ -36,9 +36,11 @@ Install spork into your test helper using the following command or manually.
spork minitest --bootstrap
-Start `spork` and run your tests using `testdrb`.
+Start `spork` and run your tests using `testdrb`. Some examples:
testdrb test/integration_test.rb
+ testdrb test/integration_test.rb -- --seed 1234
+ SPORK_PORT=8989 testdrb test/integration_test.rb
If you do `require 'test_helper'` in every test you will get `LoadError: cannot load such file -- test_helper`.
To fix that add the following to the very top of your test helper:
View
@@ -1,7 +1,10 @@
#!/usr/bin/env ruby
require 'drb'
+port = ENV['SPORK_PORT'] || 8988
+uri = ENV['SPORK_URI'] || "druby://127.0.0.1:#{port}"
+
DRb.start_service
-exit_code = DRbObject.new_with_uri("druby://127.0.0.1:8988").run(ARGV, $stderr, $stdout)
+exit_code = DRbObject.new_with_uri(uri).run(ARGV, $stderr, $stdout)
exit(exit_code || false)

0 comments on commit 4e6ed51

Please sign in to comment.