Commit 72274dd9b9ff874f02df24924b3be08cb26fce67

Authored by AntonioTerceiro
1 parent 4b817d1d

ActionItem405: removing tests for removed code


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1900 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing 1 changed file with 5 additions and 99 deletions   Show diff stats
test/functional/search_controller_test.rb
@@ -42,8 +42,8 @@ class SearchControllerTest < Test::Unit::TestCase @@ -42,8 +42,8 @@ class SearchControllerTest < Test::Unit::TestCase
42 end 42 end
43 43
44 should 'search in more than one specified types of content' do 44 should 'search in more than one specified types of content' do
45 - get :index, :query => 'something not important', :find_in => [ 'articles', 'comments' ]  
46 - assert_equivalent [:articles, :comments ], assigns(:results).keys 45 + get :index, :query => 'something not important', :find_in => [ 'articles', 'people' ]
  46 + assert_equivalent [:articles, :people ], assigns(:results).keys
47 end 47 end
48 48
49 should 'render success in search' do 49 should 'render success in search' do
@@ -111,66 +111,6 @@ class SearchControllerTest < Test::Unit::TestCase @@ -111,66 +111,6 @@ class SearchControllerTest < Test::Unit::TestCase
111 assert_not_includes assigns(:results)[:articles], art3 111 assert_not_includes assigns(:results)[:articles], art3
112 end 112 end
113 113
114 - should 'search in comments' do  
115 - person = create_user('teste').person  
116 - art = person.articles.build(:name => 'an article to be found'); art.save!  
117 - comment = art.comments.build(:title => 'comment to be found', :body => 'hfyfyh', :author => person); comment.save!  
118 - get 'index', :query => 'found', :find_in => [ 'comments' ]  
119 -  
120 - assert_includes assigns(:results)[:comments], comment  
121 - end  
122 -  
123 - should 'search in comments in a specific category' do  
124 - person = create_user('teste').person  
125 -  
126 - # in category  
127 - art1 = person.articles.build(:name => 'an article to be found')  
128 - art1.categories << @category  
129 - art1.save!  
130 - comment1 = art1.comments.build(:title => 'comment to be found', :body => 'hfyfyh', :author => person); comment1.save!  
131 -  
132 - # not in category  
133 - art2 = person.articles.build(:name => 'another article to be found')  
134 - art2.save!  
135 - comment2 = art2.comments.build(:title => 'comment to be found', :body => 'hfyfyh', :author => person); comment2.save!  
136 - get :index, :category_path => ['my-category'], :query => 'found', :find_in => [ 'comments' ]  
137 -  
138 - assert_includes assigns(:results)[:comments], comment1  
139 - assert_not_includes assigns(:results)[:comments], comment2  
140 - end  
141 -  
142 - # 'assets' menu outside any category  
143 - should 'list comments in general' do  
144 - person = create_user('teste').person  
145 - art = person.articles.build(:name => 'an article to be found'); art.save!  
146 - comment = art.comments.build(:title => 'comment to be found', :body => 'hfyfyh', :author => person); comment.save!  
147 -  
148 - get :assets, :asset => 'comments'  
149 - assert_includes assigns(:results)[:comments], comment  
150 - end  
151 -  
152 - # 'assets' menu inside a specific category  
153 - should 'list comments in a specified category' do  
154 - person = create_user('teste').person  
155 -  
156 - # in category  
157 - art1 = person.articles.build(:name => 'an article to be found')  
158 - art1.categories << @category  
159 - art1.save!  
160 - comment1 = art1.comments.build(:title => 'comment to be found', :body => 'hfyfyh', :author => person); comment1.save!  
161 -  
162 - # not in category  
163 - art2 = person.articles.build(:name => 'another article to be found')  
164 - art2.save!  
165 - comment2 = art2.comments.build(:title => 'comment to be found', :body => 'hfyfyh', :author => person); comment2.save!  
166 -  
167 -  
168 - get :assets, :asset => 'comments', :category_path => [ 'my-category' ]  
169 -  
170 - assert_includes assigns(:results)[:comments], comment1  
171 - assert_not_includes assigns(:results)[:comments], comment2  
172 - end  
173 -  
174 should 'find enterprises' do 114 should 'find enterprises' do
175 ent = Enterprise.create!(:name => 'teste', :identifier => 'teste') 115 ent = Enterprise.create!(:name => 'teste', :identifier => 'teste')
176 get 'index', :query => 'teste', :find_in => [ 'enterprises' ] 116 get 'index', :query => 'teste', :find_in => [ 'enterprises' ]
@@ -355,11 +295,11 @@ class SearchControllerTest &lt; Test::Unit::TestCase @@ -355,11 +295,11 @@ class SearchControllerTest &lt; Test::Unit::TestCase
355 295
356 names = { 296 names = {
357 :articles => 'Articles', 297 :articles => 'Articles',
358 - :comments => 'Comments',  
359 :people => 'People', 298 :people => 'People',
360 :enterprises => 'Enterprises', 299 :enterprises => 'Enterprises',
361 :communities => 'Communities', 300 :communities => 'Communities',
362 :products => 'Products', 301 :products => 'Products',
  302 + :events => 'Events',
363 } 303 }
364 names.each do |thing, description| 304 names.each do |thing, description|
365 assert_tag :tag => 'div', :attributes => { :class => /search-results-#{thing}/ }, :descendant => { :tag => 'h3', :content => Regexp.new(description) } 305 assert_tag :tag => 'div', :attributes => { :class => /search-results-#{thing}/ }, :descendant => { :tag => 'h3', :content => Regexp.new(description) }
@@ -371,11 +311,11 @@ class SearchControllerTest &lt; Test::Unit::TestCase @@ -371,11 +311,11 @@ class SearchControllerTest &lt; Test::Unit::TestCase
371 get :popup 311 get :popup
372 names = { 312 names = {
373 :articles => 'Articles', 313 :articles => 'Articles',
374 - :comments => 'Comments',  
375 :people => 'People', 314 :people => 'People',
376 :enterprises => 'Enterprises', 315 :enterprises => 'Enterprises',
377 :communities => 'Communities', 316 :communities => 'Communities',
378 :products => 'Products', 317 :products => 'Products',
  318 + :events => 'Events'
379 } 319 }
380 names.each do |thing,description| 320 names.each do |thing,description|
381 assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => "find_in[]", :value => thing.to_s, :checked => 'checked' } 321 assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => "find_in[]", :value => thing.to_s, :checked => 'checked' }
@@ -643,20 +583,6 @@ class SearchControllerTest &lt; Test::Unit::TestCase @@ -643,20 +583,6 @@ class SearchControllerTest &lt; Test::Unit::TestCase
643 assert_not_includes assigns(:results)[:articles], art2 583 assert_not_includes assigns(:results)[:articles], art2
644 end 584 end
645 585
646 - should 'display comments with a given initial' do  
647 - person = create_user('teste').person  
648 - art = person.articles.build(:name => 'an article to be found'); art.save!  
649 -  
650 - comment1 = art.comments.build(:title => 'a comment to be found', :body => 'hfyfyh', :author => person); comment1.save!  
651 - comment2 = art.comments.build(:title => 'better comment, but not found', :body => 'hfyfyh', :author => person); comment2.save!  
652 -  
653 - get :directory, :asset => 'comments', :initial => 'a'  
654 -  
655 - assert_includes assigns(:results)[:comments], comment1  
656 - assert_not_includes assigns(:results)[:comments], comment2  
657 - end  
658 -  
659 -  
660 should 'display people with a given initial, under a specific category' do 586 should 'display people with a given initial, under a specific category' do
661 587
662 in_category_and_with_initial = create_user('fergunson').person 588 in_category_and_with_initial = create_user('fergunson').person
@@ -742,26 +668,6 @@ class SearchControllerTest &lt; Test::Unit::TestCase @@ -742,26 +668,6 @@ class SearchControllerTest &lt; Test::Unit::TestCase
742 assert_not_includes assigns(:results)[:articles], art4 668 assert_not_includes assigns(:results)[:articles], art4
743 end 669 end
744 670
745 - should 'display comments with a given initial, under a specific category' do  
746 - person = create_user('teste').person  
747 - art = person.articles.build(:name => 'an article to be found'); art.save!  
748 - art.categories << @category  
749 - comment1 = art.comments.build(:title => 'a comment to be found', :body => 'hfyfyh', :author => person); comment1.save!  
750 - comment2 = art.comments.build(:title => 'better comment, but not found', :body => 'hfyfyh', :author => person); comment2.save!  
751 -  
752 - art2 = person.articles.build(:name => 'another article to be found'); art2.save!  
753 - comment3 = art2.comments.build(:title => 'a comment to be found', :body => 'hfyfyh', :author => person); comment1.save!  
754 - comment4 = art2.comments.build(:title => 'better comment, but not found', :body => 'hfyfyh', :author => person); comment2.save!  
755 -  
756 -  
757 - get :directory, :asset => 'comments', :initial => 'a', :category_path => [ 'my-category' ]  
758 -  
759 - assert_includes assigns(:results)[:comments], comment1  
760 - assert_not_includes assigns(:results)[:comments], comment2  
761 - assert_not_includes assigns(:results)[:comments], comment3  
762 - assert_not_includes assigns(:results)[:comments], comment4  
763 - end  
764 -  
765 should 'find enterprise by product category' do 671 should 'find enterprise by product category' do
766 ent1 = Enterprise.create!(:name => 'test1', :identifier => 'test1') 672 ent1 = Enterprise.create!(:name => 'test1', :identifier => 'test1')
767 prod_cat = ProductCategory.create!(:name => 'pctest', :environment => Environment.default) 673 prod_cat = ProductCategory.create!(:name => 'pctest', :environment => Environment.default)
@@ -895,7 +801,7 @@ class SearchControllerTest &lt; Test::Unit::TestCase @@ -895,7 +801,7 @@ class SearchControllerTest &lt; Test::Unit::TestCase
895 assert_not_includes assigns(:results)[:events], ev3 801 assert_not_includes assigns(:results)[:events], ev3
896 end 802 end
897 803
898 - %w[ people enterprises articles events communities products comments ].each do |asset| 804 + %w[ people enterprises articles events communities products ].each do |asset|
899 should "render asset-specific template when searching for #{asset}" do 805 should "render asset-specific template when searching for #{asset}" do
900 get :index, :find_in => [ asset ] 806 get :index, :find_in => [ asset ]
901 assert_template asset 807 assert_template asset