Class: Tina4::Testing::TestSuite

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ TestSuite

Returns a new instance of TestSuite.



81
82
83
84
85
86
# File 'lib/tina4/testing.rb', line 81

def initialize(name)
  @name = name
  @tests = []
  @before_each = nil
  @after_each = nil
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



79
80
81
# File 'lib/tina4/testing.rb', line 79

def name
  @name
end

#testsObject (readonly)

Returns the value of attribute tests.



79
80
81
# File 'lib/tina4/testing.rb', line 79

def tests
  @tests
end

Instance Method Details

#after_each(&block) ⇒ Object



96
97
98
# File 'lib/tina4/testing.rb', line 96

def after_each(&block)
  @after_each = block
end

#before_each(&block) ⇒ Object



92
93
94
# File 'lib/tina4/testing.rb', line 92

def before_each(&block)
  @before_each = block
end

#it(description, &block) ⇒ Object



88
89
90
# File 'lib/tina4/testing.rb', line 88

def it(description, &block)
  @tests << { name: description, block: block }
end

#run_after_eachObject



104
105
106
# File 'lib/tina4/testing.rb', line 104

def run_after_each
  @after_each&.call
end

#run_before_eachObject



100
101
102
# File 'lib/tina4/testing.rb', line 100

def run_before_each
  @before_each&.call
end