Class: Minitest::ServerReporter
- Inherits:
-
AbstractReporter
- Object
- AbstractReporter
- Minitest::ServerReporter
- Defined in:
- lib/minitest/server_plugin.rb
Instance Method Summary collapse
-
#initialize(pid) ⇒ ServerReporter
constructor
A new instance of ServerReporter.
- #record(result) ⇒ Object
- #report ⇒ Object
- #sanitize(failures) ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(pid) ⇒ ServerReporter
Returns a new instance of ServerReporter.
21 22 23 24 25 |
# File 'lib/minitest/server_plugin.rb', line 21 def initialize pid uri = Minitest::Server.path(pid) @mt_server = DRbObject.new_with_uri uri super() end |
Instance Method Details
#record(result) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/minitest/server_plugin.rb', line 31 def record result r = result c = r.class if defined?(Minitest::Result) && Minitest::Result === r then file, = r.source_location cn = r.klass else file, = r.method(r.name).source_location cn = c.name end sanitize r.failures @mt_server.result file, cn, r.name, r.failures, r.assertions, r.time end |
#report ⇒ Object
79 80 81 |
# File 'lib/minitest/server_plugin.rb', line 79 def report @mt_server.report end |
#sanitize(failures) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/minitest/server_plugin.rb', line 48 def sanitize failures failures.map! { |e| case e when Minitest::UnexpectedError then # embedded exception might not be able to be marshaled. bt = e.error.backtrace ex = RuntimeError.new(e.error.) e.error = ex ex.set_backtrace bt e = Minitest::UnexpectedError.new ex # ugh. some rails plugin. ugh. if ex.instance_variables.include? :@bindings then # web-console is Evil ex.instance_variable_set :@bindings, nil e.instance_variable_set :@bindings, nil end when Minitest::Skip then # do nothing when Minitest::Assertion then bt = e.backtrace e = e.class.new(e.) e.set_backtrace bt else warn "Unhandled exception type: #{e.class}\n\n#{e.inspect}" end e } end |
#start ⇒ Object
27 28 29 |
# File 'lib/minitest/server_plugin.rb', line 27 def start @mt_server.start end |