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 301 | Next

Kevin Marshall, Chad Pytel, and Jon Yurek

"Pro Active Record: Databases with Ruby and Rails"

The assert_respond_to
method accepts three parameters: the object, the method to which you want to assert that this
object responds, and an optional message to display in the event that the assertion fails.
Please note that you can check that your object responds to user-defined methods as well as
Ruby methods. In our example, we check that our result responds to the upcase method (which
is a part of the String class) and that our object itself responds to our appreciate method.
# test_artest.rb Unit Test example
require 'artest'
require 'test/unit'
class TestArtest < Test::Unit::TestCase
def test_simple
temp = Artest.new
assert_respond_to temp, :appreciate
response = temp.appreciate(1)
assert_responds_to response, :upcase
end
end
CHAPTER 6 ?–  ACTIVE RECORD TESTING AND DEBUGGING 134
assert_match
The asset_match method checks that a given regular expression has a match within a given
string value. The method accepts three parameters: the regular expression, the string to apply
the regular expression to, and an optional message to display in the event that the assertion fails.


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