Sha256: 7a7eb6ee08ac8dea9472983571d86c25cd2e9e1b5e08ac30d23903a4d7c398b5

Contents?: true

Size: 477 Bytes

Versions: 3

Compression:

Stored size: 477 Bytes

Contents

class String

  def vcr_path(example, spec_name)
    self.scan(/^(.*?)::[#a-z]/) do |class_names|
      class_name = class_names.flatten.first

      if class_name.nil?
        @path = example.class.name.prep
      else
        @path = example.class.name.gsub(class_name, "").prep.unshift(class_name)
      end
    end

    @path.push(spec_name).join("/") unless @path.nil?
  end

  def prep
    split("::").map {|e| e.sub(/[^\w]*$/, "")}.reject(&:empty?) - ["vcr"]
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
minitest-vcr-0.1.1 lib/extensions/string.rb
minitest-vcr-0.1.0 lib/extensions/string.rb
minitest-vcr-0.0.4 lib/extensions/string.rb