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
19
# File 'lib/turn/components/method.rb', line 11

def initialize(name)
  @name      = name
  @fail      = false
  @error     = false
  @skip      = 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



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

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

#error?Boolean

Returns:

  • (Boolean)


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

def error? ; @error ; end

#fail!(assertion) ⇒ Object



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

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

#fail?Boolean

Returns:

  • (Boolean)


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

def fail?  ; @fail  ; end

#pass?Boolean

TODO: should this include ‘or @skip`?

Returns:

  • (Boolean)


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

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

#skip!(assertion) ⇒ Object



35
36
37
38
39
40
# File 'lib/turn/components/method.rb', line 35

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

#skip?Boolean

Returns:

  • (Boolean)


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

def skip?  ; @skip  ; end

#to_sObject



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

def to_s ; name ; end