Sha256: f0136f5651fc7061ab86b8b1c53220b9529b601ab833034175ed3519d3d86f84

Contents?: true

Size: 853 Bytes

Versions: 12

Compression:

Stored size: 853 Bytes

Contents

module ::RSpec::Core::Metadata
  class HashPopulator
    def populate_location_attributes
      backtrace = user_metadata.delete(:caller)
      # Throwing exceptions to get code location is expensive, so use this if the user supplied it, otherwise
      # keep empty stuff around so filter code does not crash

      # might have an empty array from caller which file_path_and_line_number_from doesn't like
      file_path, line_number = if backtrace && !backtrace.empty?
                                 file_path_and_line_number_from(backtrace)
                               else
                                 ['', -1]
                               end

      metadata[:file_path]   = file_path
      metadata[:line_number] = line_number.to_i
      metadata[:location]    = file_path.empty? ? '' : "#{file_path}:#{line_number}"
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
opal-rspec-0.8.0 lib-opal/opal/rspec/fixes/rspec/core/metadata.rb
opal-rspec-0.8.0.alpha3 lib-opal/opal/rspec/fixes/rspec/core/metadata.rb
opal-rspec-0.8.0.alpha2 lib-opal/opal/rspec/fixes/rspec/core/metadata.rb
opal-rspec-0.8.0.alpha1 lib-opal/opal/rspec/fixes/rspec/core/metadata.rb
opal-rspec-0.7.1 lib-opal/opal/rspec/fixes/rspec/core/metadata.rb
opal-rspec-0.7.0 lib-opal/opal/rspec/fixes/rspec/core/metadata.rb
opal-rspec-0.6.2 opal/opal/rspec/fixes/rspec/core/metadata.rb
opal-rspec-0.7.0.rc.2 lib-opal/opal/rspec/fixes/rspec/core/metadata.rb
opal-rspec-0.7.0.rc.1 lib-opal/opal/rspec/fixes/rspec/core/metadata.rb
opal-rspec-0.6.1 opal/opal/rspec/fixes/rspec/core/metadata.rb
opal-rspec-0.6.0 opal/opal/rspec/fixes/rspec/core/metadata.rb
opal-rspec-0.6.0.beta1 opal/opal/rspec/fixes/rspec/core/metadata.rb