From 6df0706199586b7a98a4d7d3b5f4d5af09241af6 Mon Sep 17 00:00:00 2001 From: Hiroyuki Sano Date: Wed, 12 Aug 2015 12:05:14 +0900 Subject: [PATCH] Implicitly return exit status on the "test:templates" rake task It could pass builds on Travis CI regardless of test results. Ref: https://travis-ci.org/rails/web-console/jobs/75199961#L268 --- Rakefile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 2cf5afc9..871c913c 100644 --- a/Rakefile +++ b/Rakefile @@ -25,13 +25,15 @@ namespace :test do task templates: "templates:all" namespace :templates do - task all: [ :daemonize, :npm, :rackup, :mocha, :kill ] + task all: [ :daemonize, :npm, :rackup, :mocha, :kill, :exit ] task serve: [ :npm, :rackup ] work_dir = Pathname(__FILE__).dirname.join("test/templates") pid_file = Pathname(Dir.tmpdir).join("web_console.#{SecureRandom.uuid}.pid") server_port = 29292 rackup_opts = "-p #{server_port}" + test_runner = "http://localhost:#{server_port}/html/spec_runner.html" + test_result = nil task :daemonize do rackup_opts += " -D -P #{pid_file}" @@ -46,12 +48,16 @@ namespace :test do end task :mocha do - Dir.chdir(work_dir) { system "$(npm bin)/mocha-phantomjs http://localhost:#{server_port}/html/spec_runner.html" } + Dir.chdir(work_dir) { test_result = system("$(npm bin)/mocha-phantomjs #{test_runner}") } end task :kill do system "kill #{File.read pid_file}" end + + task :exit do + exit test_result + end end end