Module: RspecInContext::InContext

Defined in:
lib/rspec_in_context/in_context.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.add_context(context_name, &block) ⇒ Object



14
15
16
# File 'lib/rspec_in_context/in_context.rb', line 14

def add_context(context_name, &block)
  contexts[context_name] = block
end

.contextsObject



10
11
12
# File 'lib/rspec_in_context/in_context.rb', line 10

def contexts
  @contexts ||= ActiveSupport::HashWithIndifferentAccess.new
end

.define_context(context_name, &block) ⇒ Object



22
23
24
# File 'lib/rspec_in_context/in_context.rb', line 22

def define_context(context_name, &block)
  InContext.add_context(context_name, &block)
end

.find_context(context_name) ⇒ Object



18
19
20
# File 'lib/rspec_in_context/in_context.rb', line 18

def find_context(context_name)
  contexts[context_name] || raise("No context found with name #{context_name}")
end

.included(base) ⇒ Object



6
7
8
# File 'lib/rspec_in_context/in_context.rb', line 6

def included(base)
  base.extend ClassMethods
end