Sha256: 4aefbc732d8aa5702bdee9c7d4b0b4637e6a6f4aa5c2e5673b1d16382b783d2b

Contents?: true

Size: 1.49 KB

Versions: 12

Compression:

Stored size: 1.49 KB

Contents

# frozen_string_literal: true

# rubocop:disable Metrics/BlockLength
module MovieOrganizer
  RSpec.describe MediaList, type: :lib do
    include_context 'media_shared'

    let(:media_list) { MediaList.new([tmpdir]) }

    context '#new' do
      %w(m4v mov mkv mp4 avi).each do |extension|
        it "includes #{extension} files" do
          create_test_file(count: 3, extension: extension)
          expect(media_list.file_collection.count).to eq(3)
        end
      end
    end

    context '.video?' do
      it 'returns true if passed filename has a video extension' do
        expect(media_list.video?('bogus.mp4')).to eq(true)
      end

      it "returns false if passed filename isn't a video extension" do
        expect(media_list.video?('bogus.mp3')).to eq(false)
      end
    end

    context '.subtitle?' do
      it 'returns true if passed filename has a subtitle extension' do
        expect(media_list.subtitle?('bogus.sub')).to eq(true)
        expect(media_list.subtitle?('bogus.srt')).to eq(true)
      end

      it "returns false if passed filename isn't a subtitle extension" do
        expect(media_list.subtitle?('bogus.mp3')).to eq(false)
      end
    end

    context '.media?' do
      it 'returns true if passed filename has a media extension' do
        expect(media_list.media?('bogus.srt')).to eq(true)
        expect(media_list.media?('bogus.mov')).to eq(true)
        expect(media_list.media?('bogus.mp3')).to eq(false)
      end
    end
  end
end
# rubocop:enable Metrics/BlockLength

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
movie_organizer-0.1.11 spec/lib/movie_organizer/media_list_spec.rb
movie_organizer-0.1.10 spec/lib/movie_organizer/media_list_spec.rb
movie_organizer-0.1.9 spec/lib/movie_organizer/media_list_spec.rb
movie_organizer-0.1.8 spec/lib/movie_organizer/media_list_spec.rb
movie_organizer-0.1.7 spec/lib/movie_organizer/media_list_spec.rb
movie_organizer-0.1.6 spec/lib/movie_organizer/media_list_spec.rb
movie_organizer-0.1.5 spec/lib/movie_organizer/media_list_spec.rb
movie_organizer-0.1.4 spec/lib/movie_organizer/media_list_spec.rb
movie_organizer-0.1.3 spec/lib/movie_organizer/media_list_spec.rb
movie_organizer-0.1.2 spec/lib/movie_organizer/media_list_spec.rb
movie_organizer-0.1.1 spec/lib/movie_organizer/media_list_spec.rb
movie_organizer-0.1.0 spec/lib/movie_organizer/media_list_spec.rb