Class: FixtureKit::MinitestAdapter
- Inherits:
-
Adapter
- Object
- Adapter
- FixtureKit::MinitestAdapter
- Defined in:
- lib/fixture_kit/adapters/minitest_adapter.rb
Constant Summary collapse
- TEST_NAME =
"fixture kit cache pregeneration"- TEST_METHOD =
:"test_#{TEST_NAME.tr(" ", "_")}"
Instance Method Summary collapse
Instance Method Details
#execute(&block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fixture_kit/adapters/minitest_adapter.rb', line 12 def execute(&block) test = test_class.new(TEST_METHOD) # Minitest runs a test by sending its name to the instance, so defining it # here leaves the reused class untouched and the block dies with the test. test.define_singleton_method(TEST_METHOD) do block.call(self) pass end result = test.run return if result.passed? raise result.failures.first.error end |
#identifier_for(identifier) ⇒ Object
27 28 29 |
# File 'lib/fixture_kit/adapters/minitest_adapter.rb', line 27 def identifier_for(identifier) ActiveSupport::Inflector.underscore(identifier.to_s) end |