Class: Smartest::Suite
- Inherits:
-
Object
- Object
- Smartest::Suite
- Defined in:
- lib/smartest/suite.rb
Instance Attribute Summary collapse
-
#around_suite_hooks ⇒ Object
readonly
Returns the value of attribute around_suite_hooks.
-
#around_test_hooks ⇒ Object
readonly
Returns the value of attribute around_test_hooks.
-
#fixture_classes ⇒ Object
readonly
Returns the value of attribute fixture_classes.
-
#matcher_modules ⇒ Object
readonly
Returns the value of attribute matcher_modules.
-
#tests ⇒ Object
readonly
Returns the value of attribute tests.
Instance Method Summary collapse
- #add_around_test_hook(location, hook) ⇒ Object
- #around_suite_hook ⇒ Object
- #around_test_hooks_for(location) ⇒ Object
-
#initialize ⇒ Suite
constructor
A new instance of Suite.
Constructor Details
#initialize ⇒ Suite
Returns a new instance of Suite.
7 8 9 10 11 12 13 14 15 |
# File 'lib/smartest/suite.rb', line 7 def initialize @tests = TestRegistry.new @fixture_classes = FixtureClassRegistry.new @matcher_modules = MatcherRegistry.new @around_suite_hooks = [] @around_test_hooks = [] @around_test_hooks_by_file = Hash.new { |hash, path| hash[path] = [] } @around_suite_hook_depth = 0 end |
Instance Attribute Details
#around_suite_hooks ⇒ Object (readonly)
Returns the value of attribute around_suite_hooks.
5 6 7 |
# File 'lib/smartest/suite.rb', line 5 def around_suite_hooks @around_suite_hooks end |
#around_test_hooks ⇒ Object (readonly)
Returns the value of attribute around_test_hooks.
5 6 7 |
# File 'lib/smartest/suite.rb', line 5 def around_test_hooks @around_test_hooks end |
#fixture_classes ⇒ Object (readonly)
Returns the value of attribute fixture_classes.
5 6 7 |
# File 'lib/smartest/suite.rb', line 5 def fixture_classes @fixture_classes end |
#matcher_modules ⇒ Object (readonly)
Returns the value of attribute matcher_modules.
5 6 7 |
# File 'lib/smartest/suite.rb', line 5 def matcher_modules @matcher_modules end |
#tests ⇒ Object (readonly)
Returns the value of attribute tests.
5 6 7 |
# File 'lib/smartest/suite.rb', line 5 def tests @tests end |
Instance Method Details
#add_around_test_hook(location, hook) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/smartest/suite.rb', line 17 def add_around_test_hook(location, hook) if running_around_suite_hook? @around_test_hooks << hook else @around_test_hooks_by_file[path_for(location)] << hook end end |
#around_suite_hook ⇒ Object
29 30 31 32 33 34 |
# File 'lib/smartest/suite.rb', line 29 def around_suite_hook @around_suite_hook_depth += 1 yield ensure @around_suite_hook_depth -= 1 end |
#around_test_hooks_for(location) ⇒ Object
25 26 27 |
# File 'lib/smartest/suite.rb', line 25 def around_test_hooks_for(location) @around_test_hooks_by_file[path_for(location)].dup end |