testowl 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/testowl/growl.rb +1 -1
- data/lib/testowl/monitor.rb +13 -22
- data/lib/testowl/rspec_runner.rb +1 -1
- data/lib/testowl/test_unit_runner.rb +1 -1
- data/lib/testowl/tester.rb +42 -0
- data/lib/testowl/version.rb +1 -1
- data/lib/testowl.rb +1 -0
- data/testowl.gemspec +4 -3
- metadata +8 -7
data/lib/testowl/growl.rb
CHANGED
@@ -20,7 +20,7 @@ module Testowl
|
|
20
20
|
options << "--sticky" if status == :error
|
21
21
|
options << "--image '#{image_path(status)}'"
|
22
22
|
options << "--identifier #{Digest::MD5.hexdigest files.join}" # (used for coalescing)
|
23
|
-
title = "
|
23
|
+
title = "TestOwl #{title} (#{project})"
|
24
24
|
system %(#{growlnotify} #{options.join(' ')} '#{title}' &)
|
25
25
|
puts message
|
26
26
|
end
|
data/lib/testowl/monitor.rb
CHANGED
@@ -22,37 +22,28 @@ module Testowl
|
|
22
22
|
# Watch the scripts themselves
|
23
23
|
script.watch("#{test_dir}/.*/*_#{test_suffix}\.rb") do |match|
|
24
24
|
puts "Detected change in #{match[0]}"
|
25
|
-
|
25
|
+
run_test(match[0])
|
26
26
|
end
|
27
27
|
# Watch models
|
28
28
|
script.watch("app/models/(.*)\.rb") do |match|
|
29
29
|
puts "Detected change in #{match[0]}"
|
30
|
-
|
31
|
-
model = match[1]
|
32
|
-
tests += tests_for_model(model)
|
33
|
-
fire tests, "triggered by #{match[0]}"
|
30
|
+
run_model(match[1], "triggered by #{match[0]}")
|
34
31
|
end
|
35
32
|
puts "Monitoring files..."
|
36
33
|
Watchr::Controller.new(script, Watchr.handler.new).run
|
37
34
|
end
|
38
35
|
|
39
|
-
def
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
else
|
51
|
-
Growl.grr "Pass", "All #{test_count} example#{'s' if test_count > 1} passed in #{timing} :)", :success, files, reason
|
52
|
-
end
|
53
|
-
rescue => exc
|
54
|
-
Growl.grr "Exception", exc.message, :error, files, reason
|
55
|
-
end
|
36
|
+
def run_test(file)
|
37
|
+
tester = Tester.new(@runner, "has been updated")
|
38
|
+
tester.add file
|
39
|
+
tester.run
|
40
|
+
end
|
41
|
+
|
42
|
+
def run_model(model_name, reason)
|
43
|
+
tester = Tester.new(@runner, reason)
|
44
|
+
tester.add Dir["#{test_dir}/**/#{model_name}_#{test_suffix}.rb"]
|
45
|
+
tester.add Dir["#{test_dir}/**/#{model_name.pluralize}_controller_#{test_suffix}.rb"]
|
46
|
+
tester.run
|
56
47
|
end
|
57
48
|
|
58
49
|
def tests_for_model(model)
|
data/lib/testowl/rspec_runner.rb
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
module Testowl
|
2
|
+
class Tester
|
3
|
+
|
4
|
+
def initialize(runner, reason)
|
5
|
+
@runner = runner
|
6
|
+
@reason = reason
|
7
|
+
@files_list = []
|
8
|
+
end
|
9
|
+
|
10
|
+
def add(files)
|
11
|
+
@files_list << [files].flatten
|
12
|
+
end
|
13
|
+
|
14
|
+
def run
|
15
|
+
test_count = 0
|
16
|
+
fail_count = 0
|
17
|
+
files_run = []
|
18
|
+
begin
|
19
|
+
@files_list.each do |files|
|
20
|
+
result = @runner.run(files)
|
21
|
+
files_run += files
|
22
|
+
test_count += result[0]
|
23
|
+
fail_count += result[1]
|
24
|
+
break if fail_count > 0
|
25
|
+
end
|
26
|
+
if test_count == 0
|
27
|
+
Growl.grr "Empty Test", "No tests run", :error, files_run, @reason
|
28
|
+
return false
|
29
|
+
elsif fail_count > 0
|
30
|
+
Growl.grr "Fail", "#{fail_count} out of #{test_count} test#{'s' if test_count > 1} failed :(", :failed, files_run, @reason
|
31
|
+
return false
|
32
|
+
else
|
33
|
+
Growl.grr "Pass", "All #{test_count} example#{'s' if test_count > 1} passed :)", :success, files_run, @reason
|
34
|
+
return true
|
35
|
+
end
|
36
|
+
rescue => exc
|
37
|
+
Growl.grr "Exception", exc.message, :error, files_run, @reason
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
data/lib/testowl/version.rb
CHANGED
data/lib/testowl.rb
CHANGED
data/testowl.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Bill Horsman"]
|
10
10
|
s.email = ["bill@logicalcobwebs.com"]
|
11
|
-
s.homepage = ""
|
12
|
-
s.summary = %q{TestUnit, Watchr and Growl Integration for Continuous Testing}
|
13
|
-
s.description = %q{TestUnit, Watchr and Growl Integration for Continuous Testing}
|
11
|
+
s.homepage = "https://github.com/billhorsman/testowl"
|
12
|
+
s.summary = %q{TestUnit/RSpec, Watchr and Growl Integration for Continuous Testing}
|
13
|
+
s.description = %q{TestUnit/RSpec, Watchr and Growl Integration for Continuous Testing}
|
14
14
|
|
15
15
|
s.add_runtime_dependency "watchr"
|
16
16
|
s.add_runtime_dependency "rails"
|
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
|
|
29
29
|
"lib/testowl/monitor.rb",
|
30
30
|
"lib/testowl/rspec_runner.rb",
|
31
31
|
"lib/testowl/test_unit_runner.rb",
|
32
|
+
"lib/testowl/tester.rb",
|
32
33
|
"lib/testowl/version.rb",
|
33
34
|
"testowl.gemspec"
|
34
35
|
]
|
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: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
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-21 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
type: :runtime
|
47
47
|
requirement: *id002
|
48
48
|
name: rails
|
49
|
-
description: TestUnit, Watchr and Growl Integration for Continuous Testing
|
49
|
+
description: TestUnit/RSpec, Watchr and Growl Integration for Continuous Testing
|
50
50
|
email:
|
51
51
|
- bill@logicalcobwebs.com
|
52
52
|
executables:
|
@@ -69,10 +69,11 @@ files:
|
|
69
69
|
- lib/testowl/monitor.rb
|
70
70
|
- lib/testowl/rspec_runner.rb
|
71
71
|
- lib/testowl/test_unit_runner.rb
|
72
|
+
- lib/testowl/tester.rb
|
72
73
|
- lib/testowl/version.rb
|
73
74
|
- testowl.gemspec
|
74
75
|
has_rdoc: true
|
75
|
-
homepage:
|
76
|
+
homepage: https://github.com/billhorsman/testowl
|
76
77
|
licenses: []
|
77
78
|
|
78
79
|
post_install_message:
|
@@ -104,6 +105,6 @@ rubyforge_project:
|
|
104
105
|
rubygems_version: 1.5.0
|
105
106
|
signing_key:
|
106
107
|
specification_version: 3
|
107
|
-
summary: TestUnit, Watchr and Growl Integration for Continuous Testing
|
108
|
+
summary: TestUnit/RSpec, Watchr and Growl Integration for Continuous Testing
|
108
109
|
test_files: []
|
109
110
|
|