1 require 'abstract_unit'
16 def link_to_person(person
)
17 link_to person
.name
, person
21 class PeopleHelperTest
< ActionView
::TestCase
23 ActionController
::Routing::Routes.draw
do |map
|
24 map
.people
'people', :controller => 'people', :action => 'index'
25 map
.connect
':controller/:action/:id'
30 assert_equal
"<h1>Ruby on Rails</h1>", title("Ruby on Rails")
33 def test_homepage_path
34 assert_equal
"/people", homepage_path
38 assert_equal
"http://test.host/people", homepage_url
41 def test_link_to_person
42 person
= mock(:name => "David")
43 expects(:mocha_mock_path).with(person
).returns("/people/1")
44 assert_equal
'<a href="/people/1">David</a>', link_to_person(person
)
48 class CrazyHelperTest
< ActionView
::TestCase
51 def test_helper_class_can_be_set_manually_not_just_inferred
52 assert_equal PeopleHelper
, self.class.helper_class