assets_helper_test.rb
1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require File.dirname(__FILE__) + '/../test_helper'
class AssetsHelperTest < Test::Unit::TestCase
include AssetsHelper
should 'generate link to assets' do
%w[ articles
people
products
enterprises
communities
events
].each do |asset|
expects(:link_to).with(anything, { :controller => 'search', :action => 'assets', :asset => asset, :category_path => []})
end
stubs(:_).returns('')
stubs(:content_tag).returns('')
generate_assets_menu
end
should 'generate link to assets with current category' do
%w[ articles
people
products
enterprises
communities
events
].each do |asset|
expects(:link_to).with(anything, { :controller => 'search', :action => 'assets', :asset => asset, :category_path => [ 'my-category' ]})
end
stubs(:_).returns('')
stubs(:content_tag).returns('')
@category = mock
@category.expects(:explode_path).returns(['my-category']).at_least_once
generate_assets_menu
end
end