forked from semaperepelitsa/spork-minitest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
55 lines (46 loc) · 1.18 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
require 'bundler/gem_tasks'
require "fileutils"
def running(*args)
pid = spawn(*args)
yield
ensure
Process.kill :INT, pid
end
def prompt_wait message = nil
puts message
$stdin.gets
end
def run env = {}, command
puts command
out_rd, out_wr = IO.pipe
system env, command, out: out_wr
out_wr.close
puts "-" * 30, "Output:", out_rd.read, "-" * 30
end
def testdrb env = {}, args
run env, "bundle exec testdrb #{args}"
end
def cd path, &block
FileUtils.cd path, verbose: true, &block
end
task "test:unit" do
cd "unit_project" do
running "bundle exec spork minitest" do
prompt_wait "Press return when spork is loaded"
testdrb "test/first_test.rb"
testdrb "test/first_test.rb test/second_test.rb"
testdrb "test/first_test.rb -- -n test_false"
testdrb "test/first_test.rb -- -n test_false -v"
end
end
end
task "test:spec" do
cd "spec_project" do
running({"HELPER_FILE" => "spec/spec_helper.rb"}, "bundle exec spork minitest -p 8990") do
prompt_wait "Press return when spork is loaded"
testdrb({ "SPORK_PORT" => "8990" }, "spec/some_spec.rb")
end
end
end
task :test => ["test:unit", "test:spec"]
task :default => :test