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 uses_mocha
"link_to_person" do
42 def test_link_to_person
43 person
= mock(:name => "David")
44 expects(:mocha_mock_path).with(person
).returns("/people/1")
45 assert_equal
'<a href="/people/1">David</a>', link_to_person(person
)
50 class CrazyHelperTest
< ActionView
::TestCase
53 def test_helper_class_can_be_set_manually_not_just_inferred
54 assert_equal PeopleHelper
, self.class.helper_class