Sha256: 0262d6ebba2e2f14935f67661e431c0fd68196a99b63ecc7077a1b89b522f78f

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

require 'test/unit'
require 'kooaba'

class ItemTest < Test::Unit::TestCase
  def test_init_item
    item = Kooaba::Item.new(
      :title => "A lake",
      :metadata => nil,
      :image_files => ["/path/to/image"],
      :reference_id => "lake",
      :enabled => true
      )

    assert_equal item.title, "A lake"
    assert_equal item.metadata, nil
    assert_equal item.image_files, ["/path/to/image"]
    assert_equal item.reference_id, "lake"
    assert_equal item.enabled, true
  end

  def test_init_item_default_attributes
    item = Kooaba::Item.new

    assert_equal item.title, nil
    assert_equal item.metadata, nil
    assert_equal item.enabled, true
    assert_equal item.reference_id, nil
    assert_equal item.image_files, []
  end

  def test_init_wrong_type_for_enabled
    assert_raise TypeError do
      item = Kooaba::Item.new(
        :enabled => 1
        )
    end
  end

  def test_init_wrong_type_for_image_files
    assert_raise TypeError do
      item = Kooaba::Item.new(
        :image_files => "something"
        )
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kooaba-0.0.7 test/test_item.rb
kooaba-0.0.6 test/test_item.rb
kooaba-0.0.5 test/test_item.rb
kooaba-0.0.4 test/test_item.rb