Class: TableBeet::World

Inherits:
Object
  • Object
show all
Defined in:
lib/table_beet/world.rb

Defined Under Namespace

Classes: Space

Class Method Summary collapse

Class Method Details

.include_modulesObject



28
29
30
# File 'lib/table_beet/world.rb', line 28

def self.include_modules
  RSpec.configuration.instance_variable_get(:@include_modules).items_and_filters
end

.scopesHash

Returns The hash that { scope name => Array of ::TableBeet:Step }.

Returns:

  • (Hash)

    The hash that { scope name => Array of ::TableBeet:Step }



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/table_beet/world.rb', line 10

def self.scopes
  scopes = Hash.new { |hash, key| hash[key] = [] }

  include_modules.each do |mod, tags|
    space = Space.new(mod)
    step_names = space.define_steps
    next if step_names.empty?

    scope_name = tags.keys.first

    step_names.each do |name|
      scopes[scope_name] << Step.new(space.method(name))
    end
  end

  scopes
end