SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 300 | Next

Kevin Marshall, Chad Pytel, and Jon Yurek

"Pro Active Record: Databases with Ruby and Rails"


This method accepts three parameters: the class to which you want to assert an object
belongs and instance of the object, and an optional message to display in the event that the
assertion fails.
CHAPTER 6 ?–  ACTIVE RECORD TESTING AND DEBUGGING 133
# test_artest.rb Unit Test example
require 'artest'
require 'test/unit'
class TestArtest < Test::Unit::TestCase
def test_simple
temp = Artest.new
assert_instance_of String, temp.insult(1)
end
end
assert_kind_of
This method checks if a given object is a kind of a given class. Invoking the assert_kind_of
method is really the equivalent of calling the kind_of? Ruby method.
This method accepts three parameters: the class of which you want to assert an object is
a kind, the object, and an optional message to display the in the event that the assertion fails.
# test_artest.rb Unit Test example
require 'artest'
require 'test/unit'
class TestArtest < Test::Unit::TestCase
def test_simple
temp = Artest.new
assert_kind_of String, temp.insult(1)
end
end
assert_respond_to
This method checks if a given object responds to a given method call.


Pages:
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6