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

.scopesHash

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

Returns:

  • (Hash)

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



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

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

  RSpec.configuration.include_or_extend_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