Class: FasTest::TestClass
- Inherits:
-
Object
- Object
- FasTest::TestClass
- Defined in:
- lib/fas_test.rb
Overview
Base class for all test suites
Instance Attribute Summary collapse
-
#needs_teardown ⇒ Object
Returns the value of attribute needs_teardown.
-
#runner ⇒ Object
writeonly
Sets the attribute runner.
Instance Method Summary collapse
- #assert_equal(a, b, msg = "<no msg given>") ⇒ Object
- #assert_true(expression, msg = "<no msg given>") ⇒ Object
-
#class_setup ⇒ Object
This is called once before any of the tests in the class are run.
-
#class_teardown ⇒ Object
This is called once after ALL the tests in the class are done.
- #fail(msg) ⇒ Object
-
#test_setup ⇒ Object
This is called before EACH test.
-
#test_teardown ⇒ Object
This is called after EACH test.
Instance Attribute Details
#needs_teardown ⇒ Object
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
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_setup ⇒ Object
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_teardown ⇒ Object
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
200 201 202 |
# File 'lib/fas_test.rb', line 200 def fail(msg) raise AssertionException, msg end |
#test_setup ⇒ Object
This is called before EACH test
179 180 |
# File 'lib/fas_test.rb', line 179 def test_setup end |
#test_teardown ⇒ Object
This is called after EACH test
183 184 |
# File 'lib/fas_test.rb', line 183 def test_teardown end |