Commit 7bf71d8de76ecbbb4ac64988f0e8ca9de0facfdf
1 parent
1504e0b4
Exists in
master
and in
29 other branches
ActionItem4: search action in tags management tested
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@160 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
3 changed files
with
11 additions
and
3 deletions
Show diff stats
app/controllers/manage_tags_controller.rb
... | ... | @@ -73,6 +73,6 @@ class ManageTagsController < ApplicationController |
73 | 73 | |
74 | 74 | # Full-text search for tags that have the query terms |
75 | 75 | def search |
76 | - @tags_found = Tag.find_by_contents(params[:query][:term]) | |
76 | + @tags_found = Tag.find_by_contents(params[:query]) | |
77 | 77 | end |
78 | 78 | end | ... | ... |
app/views/manage_tags/_search_box.rhtml
test/functional/manage_tags_controller_test.rb
... | ... | @@ -100,10 +100,18 @@ class ManageTagsControllerTest < Test::Unit::TestCase |
100 | 100 | |
101 | 101 | def test_approve |
102 | 102 | pending_tag = Tag.create(:name => 'pending_tag', :pending => true) |
103 | - assert pending_tag.pending? | |
104 | 103 | post :approve, :id => pending_tag.id |
105 | 104 | assert_response :redirect |
106 | 105 | assert_redirected_to :action => 'list' |
107 | 106 | assert ( not Tag.find_with_pendings(pending_tag.id).pending? ) |
108 | 107 | end |
108 | + | |
109 | + def test_search | |
110 | + found_tag = Tag.create(:name => 'found_tag') | |
111 | + lost_tag = Tag.create(:name => 'lost_tag') | |
112 | + post :search, :query => 'found*' | |
113 | + assert_not_nil assigns(:tags_found) | |
114 | + assert assigns(:tags_found).include?(found_tag) | |
115 | + assert (not assigns(:tags_found).include?(lost_tag)) | |
116 | + end | |
109 | 117 | end | ... | ... |