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, &block) ⇒ 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



27
28
29
30
31
# File 'lib/rspec_in_context.rb', line 27

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