Module: RSpec::SleepingKingStudios::Deferred::Dependencies
- Extended by:
- SleepingKingStudios::Tools::Toolbox::Mixin
- Defined in:
- lib/rspec/sleeping_king_studios/deferred/dependencies.rb
Overview
Mixin for declaring dependent methods for deferred example groups.
Each dependent method is expected to have a definition, either as a direct method definition (using the ‘def` keyword or `define_method`), or via a memoized helper (such as `let`).
When the deferred examples are included in an example group and that example group is run, a before(:context) hook will check for all of the declared dependencies of that example group. If any of the expected dependencies are not defined, the hook will raise an exception listing the missing methods, the deferred examples that expect that method, and the description provided.
Defined Under Namespace
Modules: ClassMethods Classes: MissingDependenciesError
Class Method Summary collapse
-
.check_dependencies_for(example) ⇒ Object
Checks for missing dependent methods for the given example.
Class Method Details
.check_dependencies_for(example) ⇒ Object
Checks for missing dependent methods for the given example.
88 89 90 91 92 93 94 |
# File 'lib/rspec/sleeping_king_studios/deferred/dependencies.rb', line 88 def check_dependencies_for(example) missing = missing_dependencies_for(example) return if missing.empty? raise MissingDependenciesError, (missing) end |