Commit ae14ca6cee7a6e61b28be5a69794e58d884e50c7
1 parent
0b2d24fc
Exists in
master
and in
28 other branches
ActionItem4: testing tags extensions
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@120 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
4 changed files
with
5 additions
and
14 deletions
Show diff stats
app/controllers/manage_tags_controller.rb
... | ... | @@ -35,7 +35,7 @@ class ManageTagsController < ApplicationController |
35 | 35 | # Prompt for modifications on the attributes of a tag |
36 | 36 | def edit |
37 | 37 | @tag = Tag.find_with_pendings(params[:id]) |
38 | - @parent_tags = @tag.parents_candidates | |
38 | + @parent_tags = @tag.parent_candidates | |
39 | 39 | end |
40 | 40 | |
41 | 41 | # Do the modifications collected by edit |
... | ... | @@ -45,7 +45,7 @@ class ManageTagsController < ApplicationController |
45 | 45 | flash[:notice] = _('Tag was successfully updated.') |
46 | 46 | redirect_to :action => 'list' |
47 | 47 | else |
48 | - @parent_tags = @tag.parents_candidates | |
48 | + @parent_tags = @tag.parent_candidates | |
49 | 49 | render :action => 'edit' |
50 | 50 | end |
51 | 51 | end | ... | ... |
db/migrate/004_acts_as_taggable_migration.rb
... | ... | @@ -3,7 +3,7 @@ class ActsAsTaggableMigration < ActiveRecord::Migration |
3 | 3 | create_table :tags do |t| |
4 | 4 | t.column :name, :string |
5 | 5 | t.column :parent_id, :integer |
6 | - t.column :pending, :boolean | |
6 | + t.column :pending, :boolean, :default => false | |
7 | 7 | end |
8 | 8 | |
9 | 9 | create_table :taggings do |t| | ... | ... |
lib/extended_tag.rb
... | ... | @@ -17,7 +17,7 @@ class Tag |
17 | 17 | end |
18 | 18 | |
19 | 19 | # All the tags that can be a new parent for this tag, that is all but itself and its descendents to avoid loops |
20 | - def parents_candidates | |
20 | + def parent_candidates | |
21 | 21 | Tag.find(:all) - descendents - [self] |
22 | 22 | end |
23 | 23 | |
... | ... | @@ -26,9 +26,4 @@ class Tag |
26 | 26 | children.to_a.sum([], &:descendents) + children |
27 | 27 | end |
28 | 28 | |
29 | - # Test if this tag has been approved already | |
30 | - def aproved? | |
31 | - not pending? | |
32 | - end | |
33 | - | |
34 | 29 | end | ... | ... |
test/functional/manage_tags_controller_test.rb
... | ... | @@ -6,12 +6,8 @@ class ManageTagsController; def rescue_action(e) raise e end; end |
6 | 6 | |
7 | 7 | class ManageTagsControllerTest < Test::Unit::TestCase |
8 | 8 | |
9 | - def test_truth | |
10 | - assert true | |
11 | - end | |
9 | + fixtures :tags | |
12 | 10 | |
13 | -#TODO i comment it because the test were not passing | |
14 | - fixtures :tags, :users, :blocks, :profiles, :virtual_communities, :boxes, :domains | |
15 | 11 | def setup |
16 | 12 | @controller = ManageTagsController.new |
17 | 13 | @request = ActionController::TestRequest.new | ... | ... |