Method: Scope::TestCase.context

Defined in:
lib/scope.rb

.context(name, &block) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/scope.rb', line 34

def self.context(name, &block)
  context_focused = false
  if @focus_enabled && @focus_next_test_or_context
    @focus_next_test_or_context = false
    @inside_focused_context = true
    context_focused = true
  end
  parent = @contexts.last
  new_context = Context.new(name, parent)
  parent.tests_and_subcontexts << new_context
  @contexts << new_context
  block.call
  @contexts.pop
  @inside_focused_context = false if context_focused
end