@api private
Shared examples top level DSL.
@private rubocop:disable Lint/NestedMethodDefinition
# File lib/rspec/core/shared_example_group.rb, line 100 def self.definitions proc do def shared_examples(name, *args, &block) RSpec.world.shared_example_group_registry.add(:main, name, *args, &block) end alias shared_context shared_examples alias shared_examples_for shared_examples end end
@api private
Adds the top level DSL methods to Module and the top level binding.
# File lib/rspec/core/shared_example_group.rb, line 119 def self.expose_globally! return if exposed_globally? Core::DSL.change_global_dsl(&definitions) @exposed_globally = true end
@private
# File lib/rspec/core/shared_example_group.rb, line 112 def self.exposed_globally? @exposed_globally ||= false end
@api private
Removes the top level DSL methods to Module and the top level binding.
# File lib/rspec/core/shared_example_group.rb, line 128 def self.remove_globally! return unless exposed_globally? Core::DSL.change_global_dsl do undef shared_examples undef shared_context undef shared_examples_for end @exposed_globally = false end