# frozen_string_literal: true
require "oob"
class OOBTest < Minitest::Test
def test_new
oob = OOB.new
assert_kind_of OOB, oob
assert_nil oob.url
assert_nil oob.desc
end
def test_new_with_node
assert_kind_of OOB, OOB.new(Blather::XMPPNode.new)
end
property(:new_with_attrs) { [string(:alnum), string] }
def new_with_attrs(u, d)
oob = OOB.new(u, desc: d)
assert_kind_of OOB, oob
assert_equal u, oob.url
assert_equal d, oob.desc
end
def test_find_or_create_not_found
assert_kind_of OOB, OOB.find_or_create(Blather::XMPPNode.new)
end
def test_find_or_create_found
parent = Blather::XMPPNode.new
parent << OOB.new("http://example.com")
assert_kind_of OOB, OOB.find_or_create(parent)
assert_equal "http://example.com", OOB.find_or_create(parent).url
end
property(:url) { string(:alnum) }
def url(u)
oob = OOB.new
oob.url = u
assert_equal u, oob.url
end
property(:desc) { string }
def desc(d)
oob = OOB.new
oob.desc = d
assert_equal d, oob.desc
end
end