Sha256: 249945ec31d63aab188f8a2bed9a70de512959c486ee8cd630e5a28677f4094f

Contents?: true

Size: 1.44 KB

Versions: 14

Compression:

Stored size: 1.44 KB

Contents

# frozen_string_literal: true

describe BrowseEverything::FileEntry do
  let(:mtime) { Time.current }

  describe 'regular file' do
    subject do
      described_class.new(
        'file_id_01234', 'my_provider:/location/pa/th/file.m4v',
        'file.m4v', '1.2 GB', mtime, false
      )
    end

    it { is_expected.to be_a(described_class) }
    it { is_expected.not_to be_container }
    it { is_expected.not_to be_relative_parent_path }

    its(:id)       { is_expected.to eq('file_id_01234') }
    its(:location) { is_expected.to eq('my_provider:/location/pa/th/file.m4v') }
    its(:name)     { is_expected.to eq('file.m4v') }
    its(:size)     { is_expected.to eq('1.2 GB') }
    its(:mtime)    { is_expected.to eq(mtime) }
    its(:type)     { is_expected.to eq('video/mp4') }
  end

  describe 'directory' do
    subject do
      described_class.new(
        'directory_id_1234', 'my_provider:/location/pa/th',
        'th', '', mtime, true
      )
    end

    it { is_expected.to be_container }
    it { is_expected.not_to be_relative_parent_path }

    its(:type) { is_expected.to eq('application/x-directory') }
  end

  describe 'parent path' do
    subject do
      described_class.new(
        'directory_id_1234', 'my_provider:/location/pa/th',
        '..', '', mtime, true
      )
    end

    it { is_expected.to be_container }
    it { is_expected.to be_relative_parent_path }

    its(:type) { is_expected.to eq('application/x-directory') }
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
browse-everything-1.5.0 spec/lib/browse_everything/file_entry_spec.rb
browse-everything-1.4.0 spec/lib/browse_everything/file_entry_spec.rb
browse-everything-1.3.0 spec/lib/browse_everything/file_entry_spec.rb
browse-everything-1.2.0 spec/lib/browse_everything/file_entry_spec.rb
browse-everything-1.1.2 spec/lib/browse_everything/file_entry_spec.rb
browse-everything-1.1.1 spec/lib/browse_everything/file_entry_spec.rb
browse-everything-1.1.0 spec/lib/browse_everything/file_entry_spec.rb
browse-everything-1.0.2 spec/lib/browse_everything/file_entry_spec.rb
browse-everything-1.0.1 spec/lib/browse_everything/file_entry_spec.rb
browse-everything-1.0.0 spec/lib/browse_everything/file_entry_spec.rb
browse-everything-1.0.0.rc2 spec/lib/browse_everything/file_entry_spec.rb
browse-everything-1.0.0.rc1 spec/lib/browse_everything/file_entry_spec.rb
browse-everything-0.16.1 spec/lib/browse_everything/file_entry_spec.rb
browse-everything-0.16.0 spec/lib/browse_everything/file_entry_spec.rb