Sha256: b654fb1009bdd9ade00904f6a093d6be87fd8742eb7440cfedd26ea1a2a6543e

Contents?: true

Size: 791 Bytes

Versions: 3

Compression:

Stored size: 791 Bytes

Contents

module Mp4Renamer
  class FixtureHelper
    attr_reader :fixture_files,
                :fixtures_dir,
                :sample_files

    def initialize
      @fixtures_dir  = File.expand_path("../../../../fixtures", __FILE__)
      @fixture_files = %w(01.mp4 02.m4a).map { |file| [fixtures_dir, file].join(File::SEPARATOR) }
      @sample_files  = fixture_files.map { |file| sample_file(file) }
    end

    def setup
      fixture_files.each do |file|
        FileUtils.cp file, sample_file(file)
      end
    end

    def teardown
      fixture_files.each do |file|
        FileUtils.rm_rf sample_file(file)
      end
    end

    private

    def sample_file(file)
      [fixtures_dir, "sample_#{File.basename(file, '.*')}#{File.extname(file)}"].join(File::SEPARATOR)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mp4_renamer-0.1.6 test/lib/mp4_renamer/fixture_helper.rb
mp4_renamer-0.1.5 test/lib/mp4_renamer/fixture_helper.rb
mp4_renamer-0.1.4 test/lib/mp4_renamer/fixture_helper.rb