Sha256: 4fa2bec79e84f4a7d7db36ca8dfd757cb63cb4264c5d056a759a9aa45b0cd065

Contents?: true

Size: 413 Bytes

Versions: 6

Compression:

Stored size: 413 Bytes

Contents

module Assert

  class ContextInfo

    attr_reader :called_from, :klass, :file

    def initialize(klass, called_from = nil, first_caller = nil)
      @called_from = called_from || first_caller
      @klass = klass
      @file = @called_from.gsub(/\:[0-9]+.*$/, '') if @called_from
    end

    def test_name(name)
      [klass.description.to_s, name.to_s].compact.reject(&:empty?).join(' ')
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
assert-2.16.3 lib/assert/context_info.rb
assert-2.16.2 lib/assert/context_info.rb
assert-2.16.1 lib/assert/context_info.rb
assert-2.16.0 lib/assert/context_info.rb
assert-2.15.2 lib/assert/context_info.rb
assert-2.15.1 lib/assert/context_info.rb