模块: RSpec::Core::SharedExampleGroup::TopLevelDSL 私有

定义于
lib/rspec/core/shared_example_group.rb

概述

此模块是私有 API 的一部分。 如果可能,请避免使用此模块,因为它可能会在将来被移除或更改。

共享示例的顶层 DSL。

类方法摘要 折叠

类方法详情

.expose_globally!void

此方法是私有 API 的一部分。 如果可能,请避免使用此方法,因为它可能会在将来被移除或更改。

将顶层 DSL 方法添加到 Module 和顶层绑定。

126
127
128
129
130
# File 'lib/rspec/core/shared_example_group.rb', line 126
def self.expose_globally!
  return if exposed_globally?
  Core::DSL.change_global_dsl(&definitions)
  @exposed_globally = true
end

.remove_globally!void

此方法是私有 API 的一部分。 如果可能,请避免使用此方法,因为它可能会在将来被移除或更改。

从 Module 和顶层绑定中移除顶层 DSL 方法。

135
136
137
138
139
140
141
142
143
144
145
# File 'lib/rspec/core/shared_example_group.rb', line 135
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