Commit badd88984e49c9679d7c12b9bf6c4fde3c35e544

Authored by JoenioCosta
1 parent c774d83b

ActionItem252: trying to fix test to display only some categories in menu


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1830 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing 1 changed file with 14 additions and 7 deletions   Show diff stats
test/functional/application_controller_test.rb
... ... @@ -127,16 +127,23 @@ class ApplicationControllerTest < Test::Unit::TestCase
127 127 assert_no_tag :tag => 'div', :attributes => { :id => 'boxes', :class => 'boxes' }
128 128 end
129 129  
130   - # FIXME why this not work???
131   - should 'display categories in menu' do
132   - c1 = Category.create!(:name => 'category 1', :environment => Environment.default)
133   - c2 = Category.create!(:name => 'category 2', :environment => Environment.default, :parent => c1)
134   - c3 = Category.create!(:name => 'category 3', :environment => Environment.default, :parent => c1)
  130 + # FIXME why 'expects' not work???
  131 + should 'display only some categories in menu' do
  132 +
  133 + c1 = Environment.default.categories.create!(:name => 'Category 1', :display_color => 1, :parent_id => nil)
  134 + c2 = Environment.default.categories.create!(:name => 'Category 2', :display_color => nil, :parent_id => c1)
  135 + c3 = Environment.default.categories.create!(:name => 'Category 3', :display_color => nil, :parent_id => c1)
  136 +
  137 + assert_equal [c1], Environment.default.display_categories
  138 + assert_equal [c2, c3], c1.all_children
  139 +
135 140 c2.expects(:display_in_menu?).returns(true)
136 141 c3.expects(:display_in_menu?).returns(false)
  142 +
137 143 get :index
138   - assert_tag :tag => 'a', :attributes => { :content => /category 2/ }
139   - assert_no_tag :tag => 'a', :attributes => { :content => /category 3/ }
  144 +
  145 + assert_tag :tag => 'a', :content => /Category 2/
  146 + assert_no_tag :tag => 'a', :content => /Category 3/
140 147 end
141 148  
142 149 end
... ...