Sha256: c75df0d9dcb04750b96d3a6c20964cb5ac85dda126855638d99370d481337e9c

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

# frozen_string_literal: true

require 'pathname/extensions'

RSpec.describe Pathname do
  before { described_class.load_extensions :explode }

  describe '#explode' do
    specify { expect(Pathname('a').explode).to eq [Pathname('a')] }
    specify { expect(Pathname('a/b').explode).to eq [Pathname('a'), Pathname('b')] }
    specify { expect(Pathname('a/b/c').explode).to eq [Pathname('a'), Pathname('b'), Pathname('c')] }
    specify { expect(Pathname('/a').explode).to eq [Pathname('/'), Pathname('a')] }
    specify { expect(Pathname('/a/b').explode).to eq [Pathname('/'), Pathname('a'), Pathname('b')] }
    specify { expect(Pathname('/a/b/c').explode).to eq [Pathname('/'), Pathname('a'), Pathname('b'), Pathname('c')] }

    if File::ALT_SEPARATOR
      specify { expect(Pathname('c:a').explode).to eq [Pathname('c:.'), Pathname('a')] }
      specify { expect(Pathname('c:a/b').explode).to eq [Pathname('c:.'), Pathname('a'), Pathname('b')] }
      specify { expect(Pathname('c:a/b/c').explode).to eq [Pathname('c:.'), Pathname('a'), Pathname('b'), Pathname('c')] }
      specify { expect(Pathname('c:/a').explode).to eq [Pathname('c:/'), Pathname('a')] }
      specify { expect(Pathname('c:/a/b').explode).to eq [Pathname('c:/'), Pathname('a'), Pathname('b')] }
      specify { expect(Pathname('c:/a/b/c').explode).to eq [Pathname('c:/'), Pathname('a'), Pathname('b'), Pathname('c')] }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rom-files-0.2.0 spec/lib/pathname/extensions/explode_spec.rb