Module: RSpec::Given::InstanceExtensions
- Defined in:
- lib/rspec/given/extensions.rb
Overview
Provide run-time methods to support RSpec/Given infrastructure. All the methods in this module are considered private and implementation-specific.
Instance Method Summary collapse
-
#_rg_check_invariants ⇒ Object
Check all the invariants in the current and surrounding describe/context blocks, starting with the outermost context.
-
#_rg_establish_givens ⇒ Object
Establish all the Given preconditions the current and surrounding describe/context blocks, starting with the outermost context.
-
#_rg_then(&block) ⇒ Object
Implement the run-time semantics of the Then clause.
Instance Method Details
#_rg_check_invariants ⇒ Object
Check all the invariants in the current and surrounding describe/context blocks, starting with the outermost context.
26 27 28 29 30 31 32 |
# File 'lib/rspec/given/extensions.rb', line 26 def _rg_check_invariants # :nodoc: self.class.ancestors.reverse.each do |context| context._rg_invariants.each do |block| instance_eval(&block) end end end |
#_rg_establish_givens ⇒ Object
Establish all the Given preconditions the current and surrounding describe/context blocks, starting with the outermost context.
14 15 16 17 18 19 20 21 22 |
# File 'lib/rspec/given/extensions.rb', line 14 def _rg_establish_givens # :nodoc: return if defined?(@_rg_ran) self.class.ancestors.reverse.each do |context| context._rg_givens.each do |block| instance_eval(&block) end end @_rg_ran = true end |
#_rg_then(&block) ⇒ Object
Implement the run-time semantics of the Then clause.
35 36 37 38 39 |
# File 'lib/rspec/given/extensions.rb', line 35 def _rg_then(&block) # :nodoc: _rg_establish_givens _rg_check_invariants instance_eval(&block) end |