Sha256: 66d823d229b4b8c5c3a757d82e599805d837b8fc0af35bc37dfc51b96c47501b

Contents?: true

Size: 1.87 KB

Versions: 4

Compression:

Stored size: 1.87 KB

Contents

require 'test/unit'
require 'wowheadr/entity/item'

class ItemTest < Test::Unit::TestCase
  def setup
    @item = Wowheadr::Entity::Item.new
  end

  def test_item
    @item.item(12345)
    assert_equal "item=12345", @item.to_s
  end

  def test_new_item
    item = Wowheadr::Entity::Item.new(12345).level(10)
    assert_equal "item=12345&amp;lvl=10", item.to_s
  end

  def test_level
    @item.level(10)
    assert_equal "lvl=10", @item.to_s
  end

  def test_lvl
    @item.lvl(10)
    assert_equal "lvl=10", @item.to_s
  end

  def test_enchant
    @item.enchantment(501)
    assert_equal "ench=501", @item.to_s
  end

  def test_ench
    @item.ench(501)
    assert_equal "ench=501", @item.to_s
  end

  def test_gems
    @item.gems(101)
    assert_equal "gems=101", @item.to_s
  end

  def test_multiple_gems
    @item.gems(101, 201, 301)
    assert_equal "gems=101:201:301", @item.to_s
  end

  def test_multiple_gems_array
    @item.gems([101, 201, 301])
    assert_equal "gems=101:201:301", @item.to_s
  end

  def test_gems_string
    @item.gems('101:201:301')
    assert_equal "gems=101:201:301", @item.to_s
  end

  def test_pieces
    @item.pieces(101)
    assert_equal "pcs=101", @item.to_s
  end

  def test_multiple_pieces
    @item.pieces(101, 201, 301)
    assert_equal "pcs=101:201:301", @item.to_s
  end

  def test_multiple_pieces_array
    @item.pieces([101, 201, 301])
    assert_equal "pcs=101:201:301", @item.to_s
  end

  def test_pieces_string
    @item.pieces('101:201:301')
    assert_equal "pcs=101:201:301", @item.to_s
  end

  def test_random_enchantment
    @item.random_enchantment('103')
    assert_equal "rand=103", @item.to_s
  end

  def test_socket
    @item.socket(true)
    assert_equal "sock", @item.to_s
  end

  def test_chaining
    @item.level(10).enchant(501).gems(101, 201).socket(true)
    assert_equal "lvl=10&amp;ench=501&amp;gems=101:201&amp;sock", @item.to_s
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wowheadr-0.0.4 test/wowheadr/entity/item_test.rb
wowheadr-0.0.3 test/wowheadr/entity/item_test.rb
wowheadr-0.0.2 test/wowheadr/entity/item_test.rb
wowheadr-0.0.1 test/wowheadr/entity/item_test.rb