Module: Aygabtu::RSpec::ExampleGroupMethods

Defined in:
lib/aygabtu/rspec.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#aygabtu_scopeObject



12
13
14
15
16
17
18
# File 'lib/aygabtu/rspec.rb', line 12

def aygabtu_scope
  @aygabtu_scope ||= if superclass.respond_to?(:aygabtu_scope)
    superclass.aygabtu_scope
  else
    Scope::Base.blank_slate
  end
end

Instance Method Details

#aygabtu_action(action, scope, *args) ⇒ Object



31
32
33
34
# File 'lib/aygabtu/rspec.rb', line 31

def aygabtu_action(action, scope, *args)
  puts "Action #{action} after checkpoint #{aygabtu_handle.checkpoint} from #{PointOfCall.point_of_call}" if aygabtu_handle.verbose?
  ScopeActor.new(scope, self).public_send(action, *args)
end

#aygabtu_enter_context(block, scope) ⇒ Object



24
25
26
27
28
29
# File 'lib/aygabtu/rspec.rb', line 24

def aygabtu_enter_context(block, scope)
  context "Context defined at #{PointOfCall.point_of_call}" do
    self.aygabtu_scope = scope
    class_exec(&block)
  end
end

#aygabtu_handleObject



36
37
38
39
40
41
42
# File 'lib/aygabtu/rspec.rb', line 36

def aygabtu_handle
  if superclass.respond_to?(:aygabtu_handle)
    superclass.aygabtu_handle
  else
    @_aygabtu_handle ||= Handle.new
  end
end

#aygabtu_matching_routes(scope = aygabtu_scope) ⇒ Object



44
45
46
47
48
49
# File 'lib/aygabtu/rspec.rb', line 44

def aygabtu_matching_routes(scope = aygabtu_scope)
  scope = scope.scope if scope.respond_to?(:scope) # a scope chain can be pased as well
  aygabtu_handle.routes.select { |route|
    scope.matches_route?(route) && aygabtu_select_route?(route.journey_route)
  }
end

#aygabtu_scope_chainObject



20
21
22
# File 'lib/aygabtu/rspec.rb', line 20

def aygabtu_scope_chain
  @aygabtu_scope_chain ||= ScopeChain.new(self, aygabtu_scope)
end

#aygabtu_select_route?(journey_route) ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/aygabtu/rspec.rb', line 51

def aygabtu_select_route?(journey_route)
  true
end