Class: Test::Unit::Fixture::Fixture
- Inherits:
-
Object
- Object
- Test::Unit::Fixture::Fixture
- Defined in:
- lib/test/unit/fixture.rb
Instance Attribute Summary collapse
-
#cleanup ⇒ Object
readonly
Returns the value of attribute cleanup.
-
#setup ⇒ Object
readonly
Returns the value of attribute setup.
-
#teardown ⇒ Object
readonly
Returns the value of attribute teardown.
Instance Method Summary collapse
- #[](type) ⇒ Object
- #after_callbacks(type) ⇒ Object
- #before_callbacks(type) ⇒ Object
-
#initialize(test_case) ⇒ Fixture
constructor
A new instance of Fixture.
Constructor Details
#initialize(test_case) ⇒ Fixture
Returns a new instance of Fixture.
25 26 27 28 29 30 |
# File 'lib/test/unit/fixture.rb', line 25 def initialize(test_case) @test_case = test_case @setup = HookPoint.new(:after => :append) @cleanup = HookPoint.new(:before => :prepend) @teardown = HookPoint.new(:before => :prepend) end |
Instance Attribute Details
#cleanup ⇒ Object (readonly)
Returns the value of attribute cleanup.
23 24 25 |
# File 'lib/test/unit/fixture.rb', line 23 def cleanup @cleanup end |
#setup ⇒ Object (readonly)
Returns the value of attribute setup.
22 23 24 |
# File 'lib/test/unit/fixture.rb', line 22 def setup @setup end |
#teardown ⇒ Object (readonly)
Returns the value of attribute teardown.
24 25 26 |
# File 'lib/test/unit/fixture.rb', line 24 def teardown @teardown end |
Instance Method Details
#[](type) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/test/unit/fixture.rb', line 32 def [](type) case type when :setup @setup when :cleanup @cleanup when :teardown @teardown end end |
#after_callbacks(type) ⇒ Object
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/test/unit/fixture.rb', line 54 def after_callbacks(type) prepend_callbacks = [] append_callbacks = [] target_test_cases.each do |ancestor| prepend_callbacks << ancestor.fixture[type].after_prepend_callbacks append_callbacks << ancestor.fixture[type].after_append_callbacks end merge_callbacks(prepend_callbacks, append_callbacks) end |
#before_callbacks(type) ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/test/unit/fixture.rb', line 43 def before_callbacks(type) prepend_callbacks = [] append_callbacks = [] target_test_cases.each do |ancestor| prepend_callbacks << ancestor.fixture[type].before_prepend_callbacks append_callbacks << ancestor.fixture[type].before_append_callbacks end merge_callbacks(prepend_callbacks, append_callbacks) end |