Created
October 18, 2011 10:00
-
-
Save godfat/1295078 to your computer and use it in GitHub Desktop.
Run Spork without affecting `rake test`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
$LOAD_PATH.unshift('./lib').unshift('./test') | |
require 'spork' | |
# monkey patch... | |
class Spork::Server | |
def run_with str | |
eval(str) | |
end | |
end | |
load Gem.bin_path('spork', 'spork') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'drb' | |
# this allows Ruby to do some magical stuff so you can pass an output stream over DRb. | |
DRb.start_service("druby://127.0.0.1:0") | |
obj = DRbObject.new_with_uri("druby://127.0.0.1:8988") | |
obj.run_with <<-RUBY | |
require './config/application' | |
::Rails.application.require_environment! | |
RUBY | |
obj.run_with <<-RUBY | |
# This code will be run each time you run your specs. | |
loadup = lambda{ |glob| | |
Dir[glob].each{ |f| load f } | |
} | |
loadup['app/**/*.rb'] | |
loadup['lib/**/*.rb'] | |
RUBY | |
obj.run(Dir['test/**/*_test.rb'], $stderr, $stdout) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment