forked from basecamp/local_time
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
38 lines (30 loc) · 766 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require 'rake/testtask'
task default: :test
task test: ['test:helpers', 'test:javascripts']
namespace :test do
Rake::TestTask.new(:helpers) do |t|
t.pattern = "test/helpers/*test.rb"
end
task :javascripts do
puts "\n# Running JavaScript tests:\n\n"
pass = true
command = "phantomjs test/javascripts/vendor/run-qunit.coffee http://localhost:9292"
zones = %w( US/Eastern Pacific/Auckland UTC )
with_js_server do
zones.each do |tz|
pass = false unless system "TZ='#{tz}' #{command}"
end
end
exit pass ? 0 : 1
end
end
def with_js_server
begin
pid = spawn "rackup test/javascripts/runner/config.ru"
sleep 2
yield
ensure
Process.kill "INT", pid
Process.waitpid pid
end
end