Sha256: f8702dc4955eca0b9e9c944c4464bfd1f1d7e54d51b717ebb3bf1fa9e5c2b750

Contents?: true

Size: 1.86 KB

Versions: 6

Compression:

Stored size: 1.86 KB

Contents

# encoding: UTF-8
require File.dirname(__FILE__) + '/test_helper.rb'

#
# test class for the TextfileEpisodeInfo plugin that
# searches for textfiles with suitable episode
# information
#
class TestPluginTextfile < Test::Unit::TestCase
  @@directories = {
    'hmym'  => 'HMMG.705',
    'hmmg'  => 'HMMG.711',
  }

  def setup
    TestHelper.write_episode_textfile(
      @@directories["hmym"],
      "How.I.Met.Your.Mother.S07E05.Die.Exkursion.German.Dubbed.HDTV.XviD-ITG"
    )

    # two files which contains possible information
    TestHelper.write_episode_textfile(
      @@directories["hmmg"],
      "How.I.Met.Your.Mother.S07E11.Plan.B.German.Dubbed.HDTV.XviD-ITG"
    )
    TestHelper.write_episode_textfile(
      @@directories["hmmg"],
      "Show ......... : How I Met Your Mother 7x11
            IMDB ......... : http://www.imdb.com/title/tt0460649/
            Notes ........ : ",
            "nfo.nfo"
    )
    TestHelper.cwd
  end

  def teardown
    TestHelper.clean
  end

  def test_information_extraction
    VCR.use_cassette("textfile_#{method_name}") do
      how = Serienrenamer::Episode.new(@@directories['hmym'])
      data = Plugin::Textfile.generate_episode_information(how)[0]
      how.add_episode_information(data, true)
      assert_equal("S07E05 - Die Exkursion.avi", how.to_s)
    end
  end

  def test_select_right_textfile
    VCR.use_cassette("textfile_#{method_name}") do
      how = Serienrenamer::Episode.new(@@directories['hmmg'])
      data = Plugin::Textfile.generate_episode_information(how)[0]
      how.add_episode_information(data, true)
      assert_equal("S07E11 - Plan B.avi", how.to_s)
    end
  end

  def test_information_extraction_with_directory_parameter
    VCR.use_cassette("textfile_#{method_name}") do
      how = @@directories['hmym']
      data = Plugin::Textfile.generate_episode_information(how)[0]
      assert_not_nil(data)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
serienrenamer-0.0.14 test/test_plugin_textfile.rb
serienrenamer-0.0.13 test/test_plugin_textfile.rb
serienrenamer-0.0.12 test/test_plugin_textfile.rb
serienrenamer-0.0.11 test/test_plugin_textfile.rb
serienrenamer-0.0.10 test/test_plugin_textfile.rb
serienrenamer-0.0.9 test/test_plugin_textfile.rb