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.76.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.76.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.75.2 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.75.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.75.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.74.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.74.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.73.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.72.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.70.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.70.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.69.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.69.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.68.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.67.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.67.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.66.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.65.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.65.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb
eac_tools-0.64.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/pathname/child_of_spec.rb