def watcher_link(objects, user)
return '' unless user && user.logged?
objects = Array.wrap(objects)
+ return '' unless objects.any?
watched = Watcher.any_watched?(objects, user)
css = [watcher_css(objects), watched ? 'icon icon-fav' : 'icon icon-fav-off'].join(' ')
assert_equal expected, watcher_link([Issue.find(1), Issue.find(3)], User.find(1))
end
+ def test_watcher_link_with_nil_should_return_empty_string
+ assert_equal '', watcher_link(nil, User.find(1))
+ end
+
test '#watcher_link with a watched object' do
Watcher.create!(:watchable => Issue.find(1), :user => User.find(1))