Sha256: 5e5f9ee7da6da6faca48adfd691972c091da859df704a5de147f30e0247a805a
Contents?: true
Size: 895 Bytes
Versions: 2
Compression:
Stored size: 895 Bytes
Contents
# frozen_string_literal: true require 'English' module TableBeet class World # # @return [Hash] The hash that { scope name => Array of ::TableBeet:Step } # 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 def self.include_modules RSpec.configuration.instance_variable_get(:@include_modules).items_and_filters end class Space def initialize(mod) extend(mod) end def define_steps methods.grep(/^match: (?<name>.+)/) { $LAST_MATCH_INFO[:name] } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
table_beet2-0.0.5 | lib/table_beet/world.rb |
table_beet2-0.0.4 | lib/table_beet/world.rb |