类: RSpec::Core::SharedExampleGroupInclusionStackFrame

继承
Object
  • Object
显示全部
定义在
lib/rspec/core/example_group.rb

概述

包含有关共享示例组的包含位置的信息。

实例属性摘要 折叠

实例方法摘要 折叠

实例属性详细信息

#inclusion_locationString (只读)

返回共享示例被包含的位置。

返回

  • (String)

    共享示例被包含的位置

786
787
788
# File 'lib/rspec/core/example_group.rb', line 786
def inclusion_location
  @inclusion_location
end

#shared_group_nameString (只读)

返回共享示例组的名称。

返回

  • (String)

    共享示例组的名称

784
785
786
# File 'lib/rspec/core/example_group.rb', line 784
def shared_group_name
  @shared_group_name
end

实例方法详细信息

#descriptionString

返回此堆栈帧的描述,采用 RSpec 内置格式化程序使用的格式。

返回

  • (String)

    此堆栈帧的描述,采用 RSpec 内置格式化程序使用的格式。

805
806
807
808
# File 'lib/rspec/core/example_group.rb', line 805
def description
  @description ||= "Shared Example Group: #{shared_group_name.inspect} " \
    "called from #{formatted_inclusion_location}"
end

#formatted_inclusion_locationString

返回 The #inclusion_location,格式化以供格式化程序显示。

返回

795
796
797
798
799
800
801
# File 'lib/rspec/core/example_group.rb', line 795
def formatted_inclusion_location
  @formatted_inclusion_location ||= begin
    RSpec.configuration.backtrace_formatter.backtrace_line(
      inclusion_location.sub(/(:\d+):in .+$/, '\1')
    )
  end
end