testowl 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/testowl/rspec_runner.rb +8 -6
- data/lib/testowl/test_unit_runner.rb +10 -12
- data/lib/testowl/version.rb +1 -1
- data/lib/testowl.rb +2 -0
- metadata +4 -4
data/lib/testowl/rspec_runner.rb
CHANGED
@@ -2,20 +2,16 @@ module Testowl
|
|
2
2
|
class RspecRunner
|
3
3
|
|
4
4
|
def run(files)
|
5
|
-
results =
|
6
|
-
lines = results.split("\n")
|
5
|
+
results = runDirectly(files)
|
6
|
+
lines = results.output.split("\n")
|
7
7
|
exception_message = lines.detect{|line| line =~ /^Exception encountered/ }
|
8
8
|
counts = lines.detect{|line| line =~ /(\d+)\sexamples?,\s(\d+)\sfailures?/ }
|
9
9
|
if counts
|
10
10
|
test_count, fail_count = counts.split(',').map(&:to_i)
|
11
11
|
timing = lines.detect{|line| line =~ /Finished\sin/}
|
12
12
|
timing = timing.sub(/Finished\sin/, '').strip if timing
|
13
|
-
if fail_count > 0
|
14
|
-
puts results
|
15
|
-
end
|
16
13
|
return test_count, fail_count, timing
|
17
14
|
else
|
18
|
-
$stderr.print results
|
19
15
|
if exception_message
|
20
16
|
raise exception_message
|
21
17
|
else
|
@@ -24,5 +20,11 @@ module Testowl
|
|
24
20
|
end
|
25
21
|
end
|
26
22
|
|
23
|
+
def runDirectly(files)
|
24
|
+
results = TestOwl::Teeio.new
|
25
|
+
results.run "rspec -c #{files.join(" ")}"
|
26
|
+
results.output
|
27
|
+
end
|
28
|
+
|
27
29
|
end
|
28
30
|
end
|
@@ -11,12 +11,11 @@ module Testowl
|
|
11
11
|
class TestUnitRunner
|
12
12
|
|
13
13
|
def run(files)
|
14
|
-
results =
|
15
|
-
|
16
|
-
results = runDrb(files)
|
14
|
+
results = begin
|
15
|
+
runDrb(files)
|
17
16
|
rescue
|
18
17
|
puts "Drb not available. Running tests directly instead."
|
19
|
-
|
18
|
+
runDirectly(files)
|
20
19
|
end
|
21
20
|
puts "Done"
|
22
21
|
lines = results.split("\n")
|
@@ -26,15 +25,11 @@ module Testowl
|
|
26
25
|
file_count, test_count, fail_count = counts.split(',').map(&:to_i)
|
27
26
|
timing = lines.detect{|line| line =~ /Finished\sin/}
|
28
27
|
timing = timing.sub(/Finished\sin/, '').strip if timing
|
29
|
-
if fail_count > 0
|
30
|
-
puts results
|
31
|
-
end
|
32
28
|
return test_count, fail_count, timing
|
33
29
|
else
|
34
30
|
if exception_message
|
35
31
|
raise exception_message
|
36
32
|
else
|
37
|
-
$stderr.print results
|
38
33
|
raise "Problem interpreting result. Please check the terminal output."
|
39
34
|
end
|
40
35
|
end
|
@@ -43,14 +38,17 @@ module Testowl
|
|
43
38
|
def runDrb(files)
|
44
39
|
DRb.start_service("druby://127.0.0.1:0") # this allows Ruby to do some magical stuff so you can pass an output stream over DRb.
|
45
40
|
test_server = DRbObject.new_with_uri("druby://127.0.0.1:8988")
|
46
|
-
results =
|
47
|
-
test_server.run(files,
|
48
|
-
results.
|
41
|
+
results = TestOwl::Teeio.new
|
42
|
+
test_server.run(files, results, results)
|
43
|
+
results.output
|
49
44
|
end
|
50
45
|
|
51
46
|
def runDirectly(files)
|
52
|
-
|
47
|
+
results = TestOwl::Teeio.new
|
48
|
+
results.run "ruby #{files.join(' ')}"
|
49
|
+
results.output
|
53
50
|
end
|
54
51
|
|
55
52
|
end
|
53
|
+
|
56
54
|
end
|
data/lib/testowl/version.rb
CHANGED
data/lib/testowl.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testowl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Bill Horsman
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-06-
|
18
|
+
date: 2011-06-22 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|