From badd88984e49c9679d7c12b9bf6c4fde3c35e544 Mon Sep 17 00:00:00 2001 From: JoenioCosta Date: Fri, 23 May 2008 14:51:27 +0000 Subject: [PATCH] ActionItem252: trying to fix test to display only some categories in menu --- test/functional/application_controller_test.rb | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/test/functional/application_controller_test.rb b/test/functional/application_controller_test.rb index 8d1e7a3..f84d97a 100644 --- a/test/functional/application_controller_test.rb +++ b/test/functional/application_controller_test.rb @@ -127,16 +127,23 @@ class ApplicationControllerTest < Test::Unit::TestCase assert_no_tag :tag => 'div', :attributes => { :id => 'boxes', :class => 'boxes' } end - # FIXME why this not work??? - should 'display categories in menu' do - c1 = Category.create!(:name => 'category 1', :environment => Environment.default) - c2 = Category.create!(:name => 'category 2', :environment => Environment.default, :parent => c1) - c3 = Category.create!(:name => 'category 3', :environment => Environment.default, :parent => c1) + # FIXME why 'expects' not work??? + should 'display only some categories in menu' do + + c1 = Environment.default.categories.create!(:name => 'Category 1', :display_color => 1, :parent_id => nil) + c2 = Environment.default.categories.create!(:name => 'Category 2', :display_color => nil, :parent_id => c1) + c3 = Environment.default.categories.create!(:name => 'Category 3', :display_color => nil, :parent_id => c1) + + assert_equal [c1], Environment.default.display_categories + assert_equal [c2, c3], c1.all_children + c2.expects(:display_in_menu?).returns(true) c3.expects(:display_in_menu?).returns(false) + get :index - assert_tag :tag => 'a', :attributes => { :content => /category 2/ } - assert_no_tag :tag => 'a', :attributes => { :content => /category 3/ } + + assert_tag :tag => 'a', :content => /Category 2/ + assert_no_tag :tag => 'a', :content => /Category 3/ end end -- libgit2 0.21.2