Class: Confiner::Example

Inherits:
Object
  • Object
show all
Defined in:
lib/confiner/example.rb

Overview

Representation of an example (test)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**attributes) {|_self| ... } ⇒ Example

Returns a new instance of Example.

Yields:

  • (_self)

Yield Parameters:



8
9
10
11
12
13
14
15
16
# File 'lib/confiner/example.rb', line 8

def initialize(**attributes)
  @status = attributes.fetch('status') { attributes.fetch(:status) }
  @name = attributes.fetch('name') { attributes.fetch(:name) }
  @classname = attributes.fetch('classname') { attributes.fetch(:classname) }
  @file = attributes.fetch('file') { attributes.fetch(:file) }
  @occurrence = attributes.fetch('occurrence') { attributes.fetch(:occurrence) }

  yield(self) if block_given?
end

Instance Attribute Details

#classnameObject

Returns the value of attribute classname.



6
7
8
# File 'lib/confiner/example.rb', line 6

def classname
  @classname
end

#fileObject

Returns the value of attribute file.



6
7
8
# File 'lib/confiner/example.rb', line 6

def file
  @file
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/confiner/example.rb', line 6

def name
  @name
end

#occurrenceObject

Returns the value of attribute occurrence.



6
7
8
# File 'lib/confiner/example.rb', line 6

def occurrence
  @occurrence
end

#statusObject

Returns the value of attribute status.



6
7
8
# File 'lib/confiner/example.rb', line 6

def status
  @status
end

Instance Method Details

#failed?Boolean

Check if this example had failed

Returns:

  • (Boolean)

    true if the example had failed



26
27
28
# File 'lib/confiner/example.rb', line 26

def failed?
  status == 'failed'
end

#passed?Boolean

Check if this example had passed

Returns:

  • (Boolean)

    true if the example had passed



20
21
22
# File 'lib/confiner/example.rb', line 20

def passed?
  status == 'success'
end

#skipped?Boolean

Check if this example had been skipped

Returns:

  • (Boolean)

    true if the example had been skipped



32
33
34
# File 'lib/confiner/example.rb', line 32

def skipped?
  status == 'skipped'
end

#to_sObject



36
# File 'lib/confiner/example.rb', line 36

def to_s; name; end