Module: RSpec::SleepingKingStudios::Concerns::FocusExamples
- Defined in:
- lib/rspec/sleeping_king_studios/concerns/focus_examples.rb
Overview
Convenience methods for automatically focusing or skipping shared example groups.
Instance Method Summary collapse
-
#finclude_examples(name, *args, **kwargs) { ... } ⇒ Object
(also: #finclude_context)
Includes the specified shared example group and wraps it inside an
fdescribeblock named "(focused)". -
#xinclude_examples(name, *args, **kwargs) { ... } ⇒ Object
(also: #xinclude_context)
Includes the specified shared example group and wraps it inside an
xdescribeblock named "(skipped)".
Instance Method Details
#finclude_examples(name, *args, **kwargs) { ... } ⇒ Object Also known as: finclude_context
Do not use this method with example groups that have side effects,
e.g. define a memoized #let helper or a #before block that is
intended to modify the behavior of sibling examples. Wrapping the
example group in a describe block breaks that relationship. Best
practice is to use the #wrap_examples method to safely encapsulate
example groups with side effects, and the #fwrap_examples method to
automatically focus such groups.
Includes the specified shared example group and wraps it inside an
fdescribe block named "(focused)". If the spec runner is set to run only
focused specs, this will ensure that the wrapped example group is run.
28 29 30 31 32 33 34 35 36 |
# File 'lib/rspec/sleeping_king_studios/concerns/focus_examples.rb', line 28 def finclude_examples name, *args, **kwargs, &block fdescribe '(focused)' do if kwargs.empty? include_examples name, *args, &block else include_examples name, *args, **kwargs, &block end # if-else end # describe end |
#xinclude_examples(name, *args, **kwargs) { ... } ⇒ Object Also known as: xinclude_context
Do not use this method with example groups that have side effects,
e.g. define a memoized #let helper or a #before block that is
intended to modify the behavior of sibling examples. Wrapping the
example group in a describe block breaks that relationship. Best
practice is to use the #wrap_examples method to safely encapsulate
example groups with side effects, and the #xwrap_examples method to
automatically skip such groups.
Includes the specified shared example group and wraps it inside an
xdescribe block named "(skipped)". This will ensure that the wrapped
example group is not run.
groups.
59 60 61 62 63 64 65 66 67 |
# File 'lib/rspec/sleeping_king_studios/concerns/focus_examples.rb', line 59 def xinclude_examples name, *args, **kwargs, &block xdescribe '(skipped)' do if kwargs.empty? include_examples name, *args, &block else include_examples name, *args, **kwargs, &block end # if-else end # describe end |