Module: EvelpidonTestHelpers::ActiveModel::Fixtures::Assertions
- Included in:
- ActiveSupport::TestCase
- Defined in:
- lib/evelpidon_test_helpers/active_model/fixtures.rb
Instance Method Summary collapse
-
#assert_valid_fixtures ⇒ Object
Asserts that all the records for the current model under test are valid.
Instance Method Details
#assert_valid_fixtures ⇒ Object
Asserts that all the records for the current model under test are valid.
This helper chooses the model name based on the current test name, so for example when the test that is running is named FooTest it will try to load all the records of Foo through Foo.all and then call assert_valid
on each one of them.
10 11 12 13 14 15 |
# File 'lib/evelpidon_test_helpers/active_model/fixtures.rb', line 10 def assert_valid_fixtures model = self.class.to_s.gsub("Controller", "").gsub("Test", "").constantize model.all.each do |fixture| assert_valid fixture, fixture.inspect end end |