testowl 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,20 +2,16 @@ module Testowl
2
2
  class RspecRunner
3
3
 
4
4
  def run(files)
5
- results = `rspec -c #{files.join(" ")}`
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 = nil
15
- begin
16
- results = runDrb(files)
14
+ results = begin
15
+ runDrb(files)
17
16
  rescue
18
17
  puts "Drb not available. Running tests directly instead."
19
- results = runDirectly(files)
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 = StringIO.new
47
- test_server.run(files, $stderr, results)
48
- results.string
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
- `ruby #{files.join(' ')}`
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
@@ -1,3 +1,3 @@
1
1
  module Testowl
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/testowl.rb CHANGED
@@ -1,6 +1,8 @@
1
+ require 'tempfile'
1
2
  require 'testowl/growl'
2
3
  require 'testowl/monitor'
3
4
  require 'testowl/rspec_runner'
5
+ require 'testowl/teeio'
4
6
  require 'testowl/test_unit_runner'
5
7
  require 'testowl/tester'
6
8
  require 'testowl/version'
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: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
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-21 00:00:00 -07:00
18
+ date: 2011-06-22 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency