cwninja-drunit 0.1 → 0.2
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.
- data/Rakefile +1 -1
- data/bin/drunit_remote +2 -4
- data/lib/drunit/remote_app.rb +8 -1
- data/lib/drunit.rb +1 -0
- data/test/unit/exception_handling_test.rb +13 -0
- metadata +4 -2
data/Rakefile
CHANGED
@@ -17,7 +17,7 @@ end
|
|
17
17
|
|
18
18
|
spec = Gem::Specification.new do |s|
|
19
19
|
s.name = %q{drunit}
|
20
|
-
s.version = "0.
|
20
|
+
s.version = "0.2"
|
21
21
|
s.summary = %q{A library for running tests across multiple applications from a single test case.}
|
22
22
|
s.description = %q{A library for running tests across multiple applications from a single test case.}
|
23
23
|
|
data/bin/drunit_remote
CHANGED
@@ -3,13 +3,11 @@
|
|
3
3
|
require File.join(File.dirname(__FILE__), *%w[.. lib drunit remote_test])
|
4
4
|
|
5
5
|
include Drunit
|
6
|
-
require ARGV.first
|
6
|
+
require ARGV.first if ARGV.first
|
7
7
|
|
8
8
|
DRb.start_service nil, RemoteTest.new
|
9
9
|
|
10
|
-
STDOUT.puts DRb.uri
|
10
|
+
STDOUT.puts "DRUNIT:URI #{DRb.uri}"
|
11
11
|
STDOUT.reopen(STDERR)
|
12
12
|
|
13
|
-
load ARGV.shift
|
14
|
-
|
15
13
|
DRb.thread.join
|
data/lib/drunit/remote_app.rb
CHANGED
@@ -29,11 +29,18 @@ module Drunit
|
|
29
29
|
raise e
|
30
30
|
end
|
31
31
|
|
32
|
+
def get_url(pipe)
|
33
|
+
pipe.each_line do |line|
|
34
|
+
return $1 if line =~ /^DRUNIT:URI (.*)$/
|
35
|
+
STDERR.puts "From drunit_remote>> #{line}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
32
39
|
def start_app!
|
33
40
|
drb_server = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "bin", "drunit_remote"))
|
34
41
|
pipe = IO.popen("#{drb_server} #{@boot}")
|
35
42
|
pid = pipe.pid
|
36
|
-
url = pipe.
|
43
|
+
url = get_url(pipe) or raise "Could not establish connection to the remote drunit instance."
|
37
44
|
remote_object = DRbObject.new(nil, url)
|
38
45
|
ObjectSpace.define_finalizer(remote_object, proc{|id| Process.kill("KILL", pid) && Process.wait})
|
39
46
|
return remote_object
|
data/lib/drunit.rb
CHANGED
@@ -28,6 +28,7 @@ module Drunit
|
|
28
28
|
|
29
29
|
def in_app(name, *args, &block)
|
30
30
|
file, line, method = caller(2).first.split(":")
|
31
|
+
method ||= "unknown_method"
|
31
32
|
remote_app_for(name).run(method.gsub(/^in /, "").gsub(/[^a-zA-Z0-9_?!]/, ""), file, line.to_i, *args, &block)
|
32
33
|
ensure
|
33
34
|
remote_app_for(name).last_assertion_count.times{ add_assertion } rescue nil
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), *%w[.. test_helper])
|
2
|
+
|
3
|
+
class ExceptionHandlingTest < Test::Unit::TestCase
|
4
|
+
include Drunit
|
5
|
+
RemoteApp(:fake_app, FAKE_APP_PATH + "/fake_app.rb")
|
6
|
+
def InApp(*args, &block)
|
7
|
+
in_app(:fake_app, *args, &block)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_should_raise_a_generic_exception
|
11
|
+
assert_raise(Drunit::RemoteError) { InApp{ raise MyModule::SomeOtherException} }
|
12
|
+
end
|
13
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cwninja-drunit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: "0.
|
4
|
+
version: "0.2"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Lea
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-04-07 00:00:00 -07:00
|
13
13
|
default_executable: drunit_remote
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -29,6 +29,7 @@ files:
|
|
29
29
|
- lib/drunit.rb
|
30
30
|
- test/fake_app/fake_app.rb
|
31
31
|
- test/test_helper.rb
|
32
|
+
- test/unit/exception_handling_test.rb
|
32
33
|
- test/unit/main_test.rb
|
33
34
|
- bin/drunit_remote
|
34
35
|
has_rdoc: true
|
@@ -61,4 +62,5 @@ signing_key:
|
|
61
62
|
specification_version: 2
|
62
63
|
summary: A library for running tests across multiple applications from a single test case.
|
63
64
|
test_files:
|
65
|
+
- test/unit/exception_handling_test.rb
|
64
66
|
- test/unit/main_test.rb
|