monkeybox 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/monkeybox.rb +7 -4
  2. data/test_monkeybox.rb +2 -1
  3. metadata +4 -4
data/monkeybox.rb CHANGED
@@ -44,12 +44,14 @@ class MonkeyBox
44
44
  stdin.puts code
45
45
  stdin.close
46
46
  yaml = stdout.read.strip
47
- #puts "YAML: <#{yaml}>"
47
+ puts "YAML: <#{yaml}>"
48
48
  report = YAML::load(yaml) || {} #need to catch puts, because the test prints a message if the test fails.
49
49
  output report[:output]
50
50
  returned report[:returned]
51
51
  error report[:error]
52
-
52
+ puts "==================================="
53
+ puts error
54
+ puts "==================================="
53
55
  err = stderr.read
54
56
  raise(err) if (err != "" )
55
57
 
@@ -71,8 +73,9 @@ end
71
73
  error = e
72
74
  end
73
75
  }
74
-
75
- puts ({:returned => returned,:output => output, :error => error, :error_trace => (error ? error.backtrace : nil) }.to_yaml)
76
+ r = {:returned => returned,:output => output}
77
+ r[:error] = {:class => error.class.name, :message => error.message, :backtrace => error.backtrace } if error
78
+ puts r.to_yaml
76
79
  puts "end".to_yaml #there is a problem with returning null, stdout seems to drop the last new line, so need something acceptable after.
77
80
  end
78
81
 
data/test_monkeybox.rb CHANGED
@@ -43,7 +43,8 @@ class TestMonkeyBox < Test::Unit::TestCase
43
43
  #puts sb.output
44
44
  assert_equal "", sb.output
45
45
  assert sb.error
46
- assert sb.error.is_a?(Exception)
46
+ assert_equal "RuntimeError", sb.error[:class]
47
+ assert /an exception/ =~ sb.error[:message]
47
48
 
48
49
  end
49
50
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monkeybox
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dominic Tarr
@@ -19,7 +19,7 @@ date: 2010-09-10 00:00:00 +12:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
22
- description: "\t\tmonkeybox runs ruby code in another ruby process.\n"
22
+ description: "\t\tmonkeybox runs ruby code in another ruby process, so that you're completely safe from monkeypatching!\n"
23
23
  email: dominic.tarr@gmail.com
24
24
  executables: []
25
25