Class: ActiveSupport::Testing::ProxyTestResult

Inherits:
Object
  • Object
show all
Defined in:
lib/active_support/testing/isolation.rb

Instance Method Summary collapse

Constructor Details

#initialize(calls = []) ⇒ ProxyTestResult

Returns a new instance of ProxyTestResult.



15
16
17
# File 'lib/active_support/testing/isolation.rb', line 15

def initialize(calls = [])
  @calls = calls
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



38
39
40
# File 'lib/active_support/testing/isolation.rb', line 38

def method_missing(name, *args)
  @calls << [name, args]
end

Instance Method Details

#__replay__(result) ⇒ Object



24
25
26
27
28
# File 'lib/active_support/testing/isolation.rb', line 24

def __replay__(result)
  @calls.each do |name, args|
    result.send(name, *args)
  end
end

#add_error(e) ⇒ Object



19
20
21
22
# File 'lib/active_support/testing/isolation.rb', line 19

def add_error(e)
  e = Test::Unit::Error.new(e.test_name, RemoteError.new(e.exception))
  @calls << [:add_error, e]
end

#marshal_dumpObject



30
31
32
# File 'lib/active_support/testing/isolation.rb', line 30

def marshal_dump
  @calls
end

#marshal_load(calls) ⇒ Object



34
35
36
# File 'lib/active_support/testing/isolation.rb', line 34

def marshal_load(calls)
  initialize(calls)
end