mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-21 01:30:12 +01:00
Changes you will need to make: * In your environment.rb, you will need to update references to a few files per environment.rb.tmpl * In your environment.rb, you will need to specify the local time zone of the computer that is running your Tracks install. Other notes on my changes: * Modified our code to take advantage of Rails 2.1's slick time zone support. * Upgraded will_paginate for compatibility * Hacked the Selenium on Rails plugin, which has not been updated in some time and does not support Rails 2.1 * Verified that all tests pass on my machine, including Selenium tests -- I'd like confirmation from others, too.
56 lines
1.2 KiB
Ruby
56 lines
1.2 KiB
Ruby
require 'abstract_unit'
|
|
|
|
module PeopleHelper
|
|
def title(text)
|
|
content_tag(:h1, text)
|
|
end
|
|
|
|
def homepage_path
|
|
people_path
|
|
end
|
|
|
|
def homepage_url
|
|
people_url
|
|
end
|
|
|
|
def link_to_person(person)
|
|
link_to person.name, person
|
|
end
|
|
end
|
|
|
|
class PeopleHelperTest < ActionView::TestCase
|
|
def setup
|
|
ActionController::Routing::Routes.draw do |map|
|
|
map.people 'people', :controller => 'people', :action => 'index'
|
|
map.connect ':controller/:action/:id'
|
|
end
|
|
end
|
|
|
|
def test_title
|
|
assert_equal "<h1>Ruby on Rails</h1>", title("Ruby on Rails")
|
|
end
|
|
|
|
def test_homepage_path
|
|
assert_equal "/people", homepage_path
|
|
end
|
|
|
|
def test_homepage_url
|
|
assert_equal "http://test.host/people", homepage_url
|
|
end
|
|
|
|
uses_mocha "link_to_person" do
|
|
def test_link_to_person
|
|
person = mock(:name => "David")
|
|
expects(:mocha_mock_path).with(person).returns("/people/1")
|
|
assert_equal '<a href="/people/1">David</a>', link_to_person(person)
|
|
end
|
|
end
|
|
end
|
|
|
|
class CrazyHelperTest < ActionView::TestCase
|
|
tests PeopleHelper
|
|
|
|
def test_helper_class_can_be_set_manually_not_just_inferred
|
|
assert_equal PeopleHelper, self.class.helper_class
|
|
end
|
|
end
|