Froze rails gems
[depot.git] / vendor / rails / actionpack / test / template / test_test.rb
1 require 'abstract_unit'
2
3 module PeopleHelper
4 def title(text)
5 content_tag(:h1, text)
6 end
7
8 def homepage_path
9 people_path
10 end
11
12 def homepage_url
13 people_url
14 end
15
16 def link_to_person(person)
17 link_to person.name, person
18 end
19 end
20
21 class PeopleHelperTest < ActionView::TestCase
22 def setup
23 ActionController::Routing::Routes.draw do |map|
24 map.people 'people', :controller => 'people', :action => 'index'
25 map.connect ':controller/:action/:id'
26 end
27 end
28
29 def test_title
30 assert_equal "<h1>Ruby on Rails</h1>", title("Ruby on Rails")
31 end
32
33 def test_homepage_path
34 assert_equal "/people", homepage_path
35 end
36
37 def test_homepage_url
38 assert_equal "http://test.host/people", homepage_url
39 end
40
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)
46 end
47 end
48 end
49
50 class CrazyHelperTest < ActionView::TestCase
51 tests PeopleHelper
52
53 def test_helper_class_can_be_set_manually_not_just_inferred
54 assert_equal PeopleHelper, self.class.helper_class
55 end
56 end