| 212 | | # test the assertion of goodies in the template |
|---|
| 213 | | def test_assert_template_has |
|---|
| 214 | | process :assign_this |
|---|
| 215 | | assert_deprecated_assertion { assert_template_has 'howdy' } |
|---|
| 216 | | end |
|---|
| 217 | | |
|---|
| 218 | | # test the assertion for goodies that shouldn't exist in the template |
|---|
| 219 | | def test_assert_template_has_no |
|---|
| 220 | | process :nothing |
|---|
| 221 | | assert_deprecated_assertion { assert_template_has_no 'maple syrup' } |
|---|
| 222 | | assert_deprecated_assertion { assert_template_has_no 'howdy' } |
|---|
| 223 | | end |
|---|
| 224 | | |
|---|
| 225 | | # test the redirection assertions |
|---|
| 226 | | def test_assert_redirect |
|---|
| 227 | | process :redirect_internal |
|---|
| 228 | | assert_deprecated_assertion { assert_redirect } |
|---|
| 229 | | end |
|---|
| 230 | | |
|---|
| 231 | | # test the redirect url string |
|---|
| 232 | | def test_assert_redirect_url |
|---|
| 233 | | process :redirect_external |
|---|
| 234 | | assert_deprecated_assertion do |
|---|
| 235 | | assert_redirect_url 'http://www.rubyonrails.org' |
|---|
| 236 | | end |
|---|
| 237 | | end |
|---|
| 238 | | |
|---|
| 239 | | # test the redirection pattern matching on a string |
|---|
| 240 | | def test_assert_redirect_url_match_string |
|---|
| 241 | | process :redirect_external |
|---|
| 242 | | assert_deprecated_assertion do |
|---|
| 243 | | assert_redirect_url_match 'rails.org' |
|---|
| 244 | | end |
|---|
| 245 | | end |
|---|
| 246 | | |
|---|
| 247 | | # test the redirection pattern matching on a pattern |
|---|
| 248 | | def test_assert_redirect_url_match_pattern |
|---|
| 249 | | process :redirect_external |
|---|
| 250 | | assert_deprecated_assertion do |
|---|
| 251 | | assert_redirect_url_match /ruby/ |
|---|
| 252 | | end |
|---|
| 253 | | end |
|---|
| 254 | | |
|---|
| 320 | | # test the flash-based assertions with something is in the flash |
|---|
| 321 | | def test_flash_assertions_full |
|---|
| 322 | | process :flash_me |
|---|
| 323 | | assert @response.has_flash_with_contents? |
|---|
| 324 | | assert_deprecated_assertion { assert_flash_exists } |
|---|
| 325 | | assert_deprecated_assertion { assert_flash_not_empty } |
|---|
| 326 | | assert_deprecated_assertion { assert_flash_has 'hello' } |
|---|
| 327 | | assert_deprecated_assertion { assert_flash_has_no 'stds' } |
|---|
| 328 | | end |
|---|
| 329 | | |
|---|
| 330 | | # test the flash-based assertions with no flash at all |
|---|
| 331 | | def test_flash_assertions_negative |
|---|
| 332 | | process :nothing |
|---|
| 333 | | assert_deprecated_assertion { assert_flash_empty } |
|---|
| 334 | | assert_deprecated_assertion { assert_flash_has_no 'hello' } |
|---|
| 335 | | assert_deprecated_assertion { assert_flash_has_no 'qwerty' } |
|---|
| 336 | | end |
|---|
| 337 | | |
|---|
| 338 | | # test the assert_rendered_file |
|---|
| 339 | | def test_assert_rendered_file |
|---|
| 340 | | assert_deprecated(/render/) { process :hello_world } |
|---|
| 341 | | assert_deprecated_assertion { assert_rendered_file 'test/hello_world' } |
|---|
| 342 | | assert_deprecated_assertion { assert_rendered_file 'hello_world' } |
|---|
| 343 | | end |
|---|
| 344 | | |
|---|
| 345 | | # test the assert_success assertion |
|---|
| 346 | | def test_assert_success |
|---|
| 347 | | process :nothing |
|---|
| 348 | | assert_deprecated_assertion { assert_success } |
|---|
| 349 | | end |
|---|
| 350 | | |
|---|
| 492 | | def test_assert_template_xpath_match_no_matches |
|---|
| 493 | | assert_deprecated(/render/) { process :hello_xml_world } |
|---|
| 494 | | assert_raises Test::Unit::AssertionFailedError do |
|---|
| 495 | | assert_deprecated_assertion do |
|---|
| 496 | | assert_template_xpath_match('/no/such/node/in/document') |
|---|
| 497 | | end |
|---|
| 498 | | end |
|---|
| 499 | | end |
|---|
| 500 | | |
|---|
| 501 | | def test_simple_one_element_xpath_match |
|---|
| 502 | | assert_deprecated(/render/) { process :hello_xml_world } |
|---|
| 503 | | assert_deprecated_assertion do |
|---|
| 504 | | assert_template_xpath_match('//title', "Hello World") |
|---|
| 505 | | end |
|---|
| 506 | | end |
|---|
| 507 | | |
|---|
| 508 | | def test_array_of_elements_in_xpath_match |
|---|
| 509 | | assert_deprecated(/render/) { process :hello_xml_world } |
|---|
| 510 | | assert_deprecated_assertion do |
|---|
| 511 | | assert_template_xpath_match('//p', %w( abes monks wiseguys )) |
|---|
| 512 | | end |
|---|
| 513 | | end |
|---|
| 514 | | |
|---|