Module: RSpec::SleepingKingStudios::Concerns::WrapExamples
- Defined in:
- lib/rspec/sleeping_king_studios/concerns/wrap_examples.rb
Overview
Methods for encapsulating shared example groups to include contexts or examples without affecting the surrounding context.
Instance Method Summary collapse
-
#fwrap_examples(name, *args, **kwargs) { ... } ⇒ Object
(also: #fwrap_context)
Includes the specified shared example group and wraps it inside a focused
fdescribeblock. -
#wrap_examples(name, *args, **kwargs) { ... } ⇒ Object
(also: #wrap_context)
Includes the specified shared example group and wraps it inside a
describeblock. -
#xwrap_examples(name, *args, **kwargs) { ... } ⇒ Object
(also: #xwrap_context)
Includes the specified shared example group and wraps it inside a skipped
xdescribeblock.
Instance Method Details
#fwrap_examples(name, *args, **kwargs) { ... } ⇒ Object Also known as: fwrap_context
Includes the specified shared example group and wraps it inside a
focused fdescribe block. If a block is provided, it is evaluated in the
context of the fdescribe block after the example group has been included.
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/rspec/sleeping_king_studios/concerns/wrap_examples.rb', line 46 def fwrap_examples name, *args, **kwargs, &block fdescribe name do if kwargs.empty? include_examples name, *args else include_examples name, *args, **kwargs end # if-else instance_eval(&block) if block_given? end # describe end |
#wrap_examples(name, *args, **kwargs) { ... } ⇒ Object Also known as: wrap_context
Includes the specified shared example group and wraps it inside a
describe block. If a block is provided, it is evaluated in the
context of the describe block after the example group has been included.
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rspec/sleeping_king_studios/concerns/wrap_examples.rb', line 21 def wrap_examples name, *args, **kwargs, &block describe name do if kwargs.empty? include_examples name, *args else include_examples name, *args, **kwargs end # if-else instance_eval(&block) if block_given? end # describe end |
#xwrap_examples(name, *args, **kwargs) { ... } ⇒ Object Also known as: xwrap_context
Includes the specified shared example group and wraps it inside a
skipped xdescribe block. If a block is provided, it is evaluated in the
context of the xdescribe block after the example group has been included.
Mostly used to temporarily disable a wrapped example group while updating
or debugging a spec.
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/rspec/sleeping_king_studios/concerns/wrap_examples.rb', line 73 def xwrap_examples name, *args, **kwargs, &block xdescribe name do if kwargs.empty? include_examples name, *args else include_examples name, *args, **kwargs end # if-else instance_eval(&block) if block_given? end # describe end |