Class: Turn::TestMethod

Inherits:
Object
  • Object
show all
Defined in:
lib/turn/components/method.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ TestMethod

Returns a new instance of TestMethod.



11
12
13
14
15
16
17
18
# File 'lib/turn/components/method.rb', line 11

def initialize(name)
  @name      = name
  @fail      = false
  @error     = false
  @raised    = nil
  @message   = nil
  @backtrace = []
end

Instance Attribute Details

#backtraceObject

Returns the value of attribute backtrace.



9
10
11
# File 'lib/turn/components/method.rb', line 9

def backtrace
  @backtrace
end

#fileObject

Returns the value of attribute file.



6
7
8
# File 'lib/turn/components/method.rb', line 6

def file
  @file
end

#messageObject

Returns the value of attribute message.



8
9
10
# File 'lib/turn/components/method.rb', line 8

def message
  @message
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/turn/components/method.rb', line 5

def name
  @name
end

#raisedObject

Returns the value of attribute raised.



7
8
9
# File 'lib/turn/components/method.rb', line 7

def raised
  @raised
end

Instance Method Details

#error!(exception) ⇒ Object



27
28
29
30
31
32
# File 'lib/turn/components/method.rb', line 27

def error!(exception)
  @fail, @error = false, true
  @raised    = exception
  @message   = exception.message
  @backtrace = exception.backtrace
end

#error?Boolean

Returns:

  • (Boolean)


35
# File 'lib/turn/components/method.rb', line 35

def error? ; @error ; end

#fail!(assertion) ⇒ Object



20
21
22
23
24
25
# File 'lib/turn/components/method.rb', line 20

def fail!(assertion)
  @fail, @error = true, false
  @raised    = assertion
  @message   = assertion.message
  @backtrace = assertion.backtrace
end

#fail?Boolean

Returns:

  • (Boolean)


34
# File 'lib/turn/components/method.rb', line 34

def fail?  ; @fail  ; end

#pass?Boolean

Returns:

  • (Boolean)


36
# File 'lib/turn/components/method.rb', line 36

def pass?  ; !(@fail or @error) ; end

#to_sObject



38
# File 'lib/turn/components/method.rb', line 38

def to_s ; name ; end