diff --git a/app/views/layouts/application.rhtml b/app/views/layouts/application.rhtml
index b8741f0..4309425 100644
--- a/app/views/layouts/application.rhtml
+++ b/app/views/layouts/application.rhtml
@@ -94,9 +94,10 @@
{ :controller=>"home" },
:id=>"menu_link_to_envhome",
:title=>@environment.name %>
- <% cache(:controller => 'public', :action => 'categories_menu', :asset => params[:asset]) do %>
+ <% cache(:controller => 'public', :action => 'categories_menu') do %>
<%= render :file => 'shared/categories_menu' %>
<% end %>
+ <%= render :file => 'shared/assets_menu' %>
diff --git a/test/integration/categories_menu_test.rb b/test/integration/categories_menu_test.rb
index 9c89be3..3636224 100644
--- a/test/integration/categories_menu_test.rb
+++ b/test/integration/categories_menu_test.rb
@@ -13,19 +13,30 @@ class CategoriesMenuTest < ActionController::IntegrationTest
should 'display link to categories' do
get '/'
- assert_tag :tag => 'a', :attributes => { :href => '/cat/food/vegetables' }
+ assert_tag :attributes => { :id => 'cat_menu' }, :descendant => { :tag => 'a', :attributes => { :href => '/cat/food/vegetables' } }
end
should 'display link to sub-categories' do
get '/cat/food'
# there must be a link to the subcategory
- assert_tag :tag => 'a', :attributes => { :href => '/cat/food/vegetables' }
+ assert_tag :attributes => { :id => 'cat_menu' }, :descendant => { :tag => 'a', :attributes => { :href => '/cat/food/vegetables' } }
end
should 'link to other assets in the same category when viewing an asset' do
get '/assets/articles/food/vegetables'
- assert_no_tag :tag => 'a', :attributes => { :href => '/cat/food/vegetables' }
- assert_tag :tag => 'a', :attributes => { :href => '/assets/enterprises/food/vegetables' }
+ assert_no_tag :attributes => { :id => 'assets_menu' }, :descendant => { :tag => 'a', :attributes => { :href => '/cat/food/vegetables' } }
+ assert_tag :attributes => { :id => 'assets_menu' }, :descendant => { :tag => 'a', :attributes => { :href => '/assets/enterprises/food/vegetables' } }
+ end
+
+ should "always link to category's initial page in category menu" do
+ get '/assets/products/food/vegetables'
+ assert_tag :attributes => { :id => 'cat_menu' }, :descendant => { :tag => 'a', :attributes => { :href => '/cat/food/vegetables' } }
+ assert_no_tag :attributes => { :id => 'cat_menu' }, :descendant => { :tag => 'a', :attributes => { :href => '/assets/products/food/vegetables' } }
+ end
+
+ should 'cache the categories menu' do
+ ActionView::Base.any_instance.expects(:cache).with(:controller => 'public', :action => 'categories_menu')
+ get '/'
end
end
--
libgit2 0.21.2