Module: RSpec

Defined in:
lib/rspec_in_context.rb,
lib/rspec_in_context/context_management.rb

Overview

RSpec

Defined Under Namespace

Modules: Core

Class Method Summary collapse

Class Method Details

.define_context(name, namespace: nil, ns: nil, silent: true, print_context: nil) ⇒ Object

Allows you to define contexts outside of RSpec.describe blocks

Parameters:

  • name (String, Symbol)

    Name of the defined context

  • namespace (String, Symbol) (defaults to: nil)

    Namespace where to store your context

  • ns (defaults to: nil)

    Alias of namespace

  • silent (Boolean) (defaults to: true)

    Does the in_context should wrap itself into a context block with its name

  • print_context (Boolean) (defaults to: nil)

    Reverse alias of silent

  • block (Proc)

    code that will be injected later



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/rspec_in_context.rb', line 31

def self.define_context(
  name,
  namespace: nil,
  ns: nil,
  silent: true,
  print_context: nil,
  &
)
  namespace ||= ns
  silent = !print_context unless print_context.nil?
  RspecInContext::InContext.outside_define_context(name, namespace, silent, &)
end