Class: Tryouts::TestCase

Inherits:
Data
  • Object
show all
Includes:
EvalAnchor
Defined in:
lib/tryouts/test_case.rb

Overview

Core data structures

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from EvalAnchor

#eval_start_line

Constructor Details

#initialize(first_code_line: nil, **rest) ⇒ TestCase

Returns a new instance of TestCase.



22
23
24
# File 'lib/tryouts/test_case.rb', line 22

def initialize(first_code_line: nil, **rest)
  super
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code

Returns:

  • (Object)

    the current value of code



19
20
21
# File 'lib/tryouts/test_case.rb', line 19

def code
  @code
end

#descriptionObject (readonly)

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



19
20
21
# File 'lib/tryouts/test_case.rb', line 19

def description
  @description
end

#expectationsObject (readonly)

Returns the value of attribute expectations

Returns:

  • (Object)

    the current value of expectations



19
20
21
# File 'lib/tryouts/test_case.rb', line 19

def expectations
  @expectations
end

#first_code_lineObject (readonly)

Returns the value of attribute first_code_line

Returns:

  • (Object)

    the current value of first_code_line



19
20
21
# File 'lib/tryouts/test_case.rb', line 19

def first_code_line
  @first_code_line
end

#first_expectation_lineObject (readonly)

Returns the value of attribute first_expectation_line

Returns:

  • (Object)

    the current value of first_expectation_line



19
20
21
# File 'lib/tryouts/test_case.rb', line 19

def first_expectation_line
  @first_expectation_line
end

#line_rangeObject (readonly)

Returns the value of attribute line_range

Returns:

  • (Object)

    the current value of line_range



19
20
21
# File 'lib/tryouts/test_case.rb', line 19

def line_range
  @line_range
end

#pathObject (readonly)

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



19
20
21
# File 'lib/tryouts/test_case.rb', line 19

def path
  @path
end

#source_linesObject (readonly)

Returns the value of attribute source_lines

Returns:

  • (Object)

    the current value of source_lines



19
20
21
# File 'lib/tryouts/test_case.rb', line 19

def source_lines
  @source_lines
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/tryouts/test_case.rb', line 26

def empty?
  code.empty?
end

#exception_expectationsObject



42
43
44
# File 'lib/tryouts/test_case.rb', line 42

def exception_expectations
  expectations.filter(&:exception?)
end

#exception_expectations?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/tryouts/test_case.rb', line 34

def exception_expectations?
  expectations.any?(&:exception?)
end

#expectations?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/tryouts/test_case.rb', line 30

def expectations?
  !expectations.empty?
end

#regular_expectationsObject



38
39
40
# File 'lib/tryouts/test_case.rb', line 38

def regular_expectations
  expectations.filter(&:regular?)
end