Re-using unit tests for models using STI
Posted
by TenJack
on Stack Overflow
See other posts from Stack Overflow
or by TenJack
Published on 2010-03-21T20:11:20Z
Indexed on
2010/03/21
20:21 UTC
Read the original article
Hit count: 396
ruby-on-rails
|unit-testing
I have a number of models that use STI and I would like to use the same unit test to test each model. For example, I have:
class RegularList < List
class OtherList < List
class ListTest < ActiveSupport::TestCase
fixtures :lists
def test_word_count
list = lists(:regular_list)
assert_equal(0, list.count)
end
end
How would I go about using the test_word_count test for the OtherList model. The test is much longer so I would rather not have to retype it for each model. Thanks.
© Stack Overflow or respective owner