Sha256: a2b6cddf831fc1bae3501a13752c5af60fc1c29dcbf532638e3b51aa005eaa63

Contents?: true

Size: 857 Bytes

Versions: 42

Compression:

Stored size: 857 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/patches/pathname/child_of'

RSpec.describe ::Pathname do
  describe 'child_of?' do
    [
      ['/foo/bar/baz', '/foo/bar', true],
      ['/foo/../foo/bar/../bar/baz', '/foo/bar', true],
      ['/foo/bar/baz', '/foo/../foo/bar/../bar', true],
      ['/foo/bar/baz', '/boink', false],
      ['/foo/bar/../not_bar/baz', '/foo/bar', false],
      ['/foo/bar/../bar_not/baz', '/foo/bar', false],
      ['/foo', '/foo/bar', false],
      ['/foo', '/bar', false],
      ['/foo', '/foo', false]
    ].each do |test_values|
      child_path, parent_path, expected_value = test_values
      context "when child=\"#{child_path}\" and parent=\"#{parent_path}\"" do
        it do
          expect(Pathname(child_path).child_of?(Pathname(parent_path))).to be(expected_value)
        end
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
eac_tools-0.63.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.62.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.62.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.61.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.61.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.60.3 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.60.2 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.60.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.60.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.59.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.58.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.57.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.56.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.56.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.55.7 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.55.6 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.55.5 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.55.4 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.55.3 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.55.2 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb