-
-
Save samccone/2e35182cf86a07800866 to your computer and use it in GitHub Desktop.
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
require 'open3' | |
namespace :casper do | |
namespace :test do | |
task :start_jasmine_runner => :environment do | |
Open3.popen3("rails s -p 5555") | |
# TODO MAKE THIS NOT BE A SIMPLE WAIT | |
sleep 30 | |
puts "Rails + jasminerice started!" | |
end | |
task :run_casperjs => :environment do | |
sh "bundle exec casperjs test --verbose=true --log-level=debug --direct --includes=casperjs/helpers/base.coffee casperjs/tests/" | |
end | |
task :stop_jasmine_runner => :environment do | |
sin, sout, serr = Open3.popen3("ps aux | grep 5555") | |
lines = sout.readlines | |
line = lines.grep(/.5555/) | |
raise "Could not locate running test rails server!" if line.empty? | |
pid = line[0].split()[1] | |
Process.kill "SIGINT", pid.to_i | |
puts "Rails + jasminerice stopped." | |
end | |
end | |
task :test => ['casper:test:start_jasmine_runner', 'casper:test:run_casperjs', 'casper:test:stop_jasmine_runner'] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment