Sha256: 6e67ec7547ebf095ce2d660f8524f0b75ddc598e1a931ce7d997bbc4210b2bb9

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

require 'test/unit'
require 'lib/rapinoe'
include Rapinoe

class TestKeynote < Test::Unit::TestCase
  def setup
    @keynote = Keynote.new('test/fixtures/ice-cream.key')
  end

  def test_path
    assert_equal 'test/fixtures/ice-cream.key', @keynote.path
  end

  def test_name
    assert_equal "ice-cream", @keynote.name
  end

  def test_size
    assert_equal 327378, @keynote.size
  end

  def test_slides
    assert_kind_of Rapinoe::Slide, @keynote.slides.first
  end

  def test_data
    assert_not_nil @keynote.data
  end

  def test_preview_data
    assert_equal 32858, @keynote.preview_data.size
  end

  def test_write_preview_to_file
    tempfile = "/tmp/rapinoe-test.jpg"

    refute File.exist?(tempfile)
    @keynote.write_preview_to_file(tempfile)

    assert File.exist?(tempfile)
    assert_operator File.size(tempfile), :>, 32858
  ensure
    File.delete tempfile
  end

  def test_write_preview_to_new_dir_and_file
    tempfile = "/tmp/rapinoe/rapinoe-test.jpg"

    refute File.exist?(tempfile)
    @keynote.write_preview_to_file(tempfile)

    assert File.exist?(tempfile)
    assert_operator File.size(tempfile), :>, 32858
  ensure
    FileUtils.rm_rf "/tmp/rapinoe"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rapinoe-0.0.2 test/test_keynote.rb