Library providing tools for writing and running RSpec tests.
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.
module RocketExamples
include RSpec::SleepingKingStudios::Deferred::Provider
deferred_examples 'should launch the rocket' do
include RSpec::SleepingKingStudios::Deferred::Dependencies
depends_on :rocket,
'an instance of Rocket where #launched? returns false'
describe '#launch' do
it 'should launch the rocket' do
expect { rocket.launch }.to change(rocket, :launched?).to be true
end
end
end
end
.check_dependencies_for(example) => Object
Checks for missing dependent methods for the given example.
Back to Documentation | Reference | RSpec | RSpec::SleepingKingStudios | RSpec::SleepingKingStudios::Deferred