Class: FasTest::TestClass

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

Overview

Base class for all test suites

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#needs_teardownObject

Returns the value of attribute needs_teardown.



168
169
170
# File 'lib/fas_test.rb', line 168

def needs_teardown
  @needs_teardown
end

#runner=(value) ⇒ Object (writeonly)

Sets the attribute runner

Parameters:

  • value

    the value to set the attribute runner to.



167
168
169
# File 'lib/fas_test.rb', line 167

def runner=(value)
  @runner = value
end

Instance Method Details

#assert_equal(a, b, msg = "<no msg given>") ⇒ Object



193
194
195
196
197
198
# File 'lib/fas_test.rb', line 193

def assert_equal(a, b, msg = "<no msg given>")
  @runner.increment_assert_count
  if a != b
    raise AssertionException, "#{msg} | expected '#{a}' but got '#{b}'"
  end
end

#assert_true(expression, msg = "<no msg given>") ⇒ Object



186
187
188
189
190
191
# File 'lib/fas_test.rb', line 186

def assert_true(expression, msg = "<no msg given>")
  @runner.increment_assert_count
  if expression != true
    raise AssertionException, "#{msg} | expected true but got #{expression.to_s}"
  end
end

#class_setupObject

This is called once before any of the tests in the class are run



171
172
# File 'lib/fas_test.rb', line 171

def class_setup
end

#class_teardownObject

This is called once after ALL the tests in the class are done



175
176
# File 'lib/fas_test.rb', line 175

def class_teardown
end

#fail(msg) ⇒ Object

Raises:



200
201
202
# File 'lib/fas_test.rb', line 200

def fail(msg)
  raise AssertionException, msg
end

#test_setupObject

This is called before EACH test



179
180
# File 'lib/fas_test.rb', line 179

def test_setup
end

#test_teardownObject

This is called after EACH test



183
184
# File 'lib/fas_test.rb', line 183

def test_teardown
end