Module: RSpec::Core::SharedContext
- Defined in:
- lib/rspec/core/shared_context.rb
Overview
Exposes ExampleGroup-level methods to a module, so you can include that module in an ExampleGroup.
Defined Under Namespace
Classes: Recording
Class Method Summary collapse
- .record(methods) ⇒ Object private
Instance Method Summary collapse
- #__shared_context_recordings ⇒ Object private
- #included(group) ⇒ Object private
Class Method Details
.record(methods) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 42 43 44 45 46 47 |
# File 'lib/rspec/core/shared_context.rb', line 39 def self.record(methods) methods.each do |meth| class_eval <<-EOS, __FILE__, __LINE__ + 1 def #{meth}(*args, &block) __shared_context_recordings << Recording.new(:#{meth}, args, block) end EOS end end |
Instance Method Details
#__shared_context_recordings ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 |
# File 'lib/rspec/core/shared_context.rb', line 28 def __shared_context_recordings @__shared_context_recordings ||= [] end |
#included(group) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 24 25 |
# File 'lib/rspec/core/shared_context.rb', line 21 def included(group) __shared_context_recordings.each do |recording| recording.playback_onto(group) end end |