Sha256: d02d3a0c4501d3669e64c75a07def5233cc16220c9d0f9ef33e0f51dfa19dfc2

Contents?: true

Size: 1.06 KB

Versions: 150

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/patches/pathname/parent_n'

RSpec.describe ::Pathname do
  [
    ['/absolute/path/to/file', 0, '/absolute/path/to/file'],
    ['/absolute/path/to/file', 1, '/absolute/path/to'],
    ['/absolute/path/to/file', 2, '/absolute/path'],
    ['/absolute/path/to/file', 3, '/absolute'],
    ['/absolute/path/to/file', 4, '/'],
    ['/absolute/path/to/file', 5, '/'],
    ['relative/path/to/file', 0, 'relative/path/to/file'],
    ['relative/path/to/file', 1, 'relative/path/to'],
    ['relative/path/to/file', 2, 'relative/path'],
    ['relative/path/to/file', 3, 'relative'],
    ['relative/path/to/file', 4, '.'],
    ['relative/path/to/file', 5, '..'],
    ['relative/path/to/file', 6, '../..']
  ].each do |test_data|
    input_path = test_data[0]
    context "when path is \"#{input_path}\"" do
      let(:n) { test_data[1] }
      let(:expected_path) { test_data[2] }

      it do
        expect(described_class.new(input_path).parent_n(n)).to(
          eq(described_class.new(expected_path))
        )
      end
    end
  end
end

Version data entries

150 entries across 150 versions & 3 rubygems

Version Path
eac_tools-0.76.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
eac_tools-0.76.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
eac_tools-0.75.2 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
eac_tools-0.75.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
eac_tools-0.75.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
eac_tools-0.74.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
eac_tools-0.74.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
eac_tools-0.73.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
eac_tools-0.72.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
eac_tools-0.70.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
eac_tools-0.70.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
eac_tools-0.69.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
eac_tools-0.69.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
eac_tools-0.68.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
eac_tools-0.67.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
eac_tools-0.67.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
eac_tools-0.66.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
eac_tools-0.65.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
eac_tools-0.65.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb
eac_tools-0.64.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/parent_n_spec.rb