Sha256: 39206469dc1bac3251b2090c2fb608783f0002e70d607e21df72bdfde76fc630

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 KB

Contents

require_relative 'test_helper'

module IOStreams
  class BasePathTest < Minitest::Test
    describe IOStreams::BasePath do
      describe '.join' do
        let(:path) { IOStreams::BasePath.new('some_path') }

        it 'returns self when no elements' do
          assert_equal path.object_id, path.join.object_id
        end

        it 'adds element to path' do
          assert_equal ::File.join('some_path', 'test'), path.join('test').to_s
        end

        it 'adds paths to root' do
          assert_equal ::File.join('some_path', 'test', 'second', 'third'), path.join('test', 'second', 'third').to_s
        end

        it 'returns path and filename' do
          assert_equal ::File.join('some_path', 'file.xls'), path.join('file.xls').to_s
        end

        it 'adds elements to path' do
          assert_equal ::File.join('some_path', 'test', 'second', 'third', 'file.xls'), path.join('test', 'second', 'third', 'file.xls').to_s
        end

        it 'return path as sent in when full path' do
          assert_equal ::File.join('some_path', 'test', 'second', 'third', 'file.xls'), path.join('some_path', 'test', 'second', 'third', 'file.xls').to_s
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
iostreams-0.20.3 test/base_path_test.rb
iostreams-0.20.2 test/base_path_test.rb
iostreams-0.20.1 test/base_path_test.rb
iostreams-0.20.0 test/base_path_test.rb