Refactor: added link_to_project helper to handle links to projects

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3924 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Baptiste Barth
2010-08-08 07:07:20 +00:00
parent 5b64f0ff96
commit a1b607480a
11 changed files with 42 additions and 15 deletions
@@ -597,4 +597,16 @@ EXPECTED
t = link_to_user(user)
assert_equal ::I18n.t(:label_user_anonymous), t
end
def test_link_to_project
project = Project.find(1)
assert_equal %(<a href="/projects/ecookbook">eCookbook</a>),
link_to_project(project)
assert_equal %(<a href="/projects/ecookbook/settings">eCookbook</a>),
link_to_project(project, :action => 'settings')
assert_equal %(<a href="http://test.host/projects/ecookbook?jump=blah">eCookbook</a>),
link_to_project(project, {:only_path => false, :jump => 'blah'})
assert_equal %(<a href="/projects/ecookbook/settings" class="project">eCookbook</a>),
link_to_project(project, {:action => 'settings'}, :class => "project")
end
end