Commit 5b0544f7f1695e0a3b09f110603a9ef4b707a9fa
1 parent
7551a835
Exists in
master
and in
28 other branches
ActionItem4: manage tags tests descommented
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@112 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
93 additions
and
94 deletions
Show diff stats
test/functional/manage_tags_controller_test.rb
... | ... | @@ -11,98 +11,97 @@ class ManageTagsControllerTest < Test::Unit::TestCase |
11 | 11 | end |
12 | 12 | |
13 | 13 | #TODO i comment it because the test were not passing |
14 | -# fixtures :tags, :users, :blocks, :profiles, :virtual_communities, :boxes, :domains | |
15 | -# def setup | |
16 | -# @controller = ManageTagsController.new | |
17 | -# @request = ActionController::TestRequest.new | |
18 | -# @response = ActionController::TestResponse.new | |
19 | -# end | |
20 | -# | |
21 | -# # Replace this with your real tests. | |
22 | -# def test_get_index | |
23 | -# get :index | |
24 | -# assert_response :redirect | |
25 | -# assert_redirected_to :action => 'list' | |
26 | -# end | |
27 | -# | |
28 | -# def test_list | |
29 | -# get :list | |
30 | -# assert_response :success | |
31 | -# assert_template 'list' | |
32 | -# assert_not_nil assigns(:tags) | |
33 | -# assert_not_nil assigns(:pending_tags) | |
34 | -# assert_nil assigns(:parent), 'the list should not scoped' | |
35 | -# end | |
36 | -# | |
37 | -# def test_scoped_list | |
38 | -# assert_nothing_raised { Tag.find(1) } | |
39 | -# get :list, :parent => Tag.find(1) | |
40 | -# assert_response :success | |
41 | -# assert_template 'list' | |
42 | -# assert_not_nil assigns(:parent), 'the list should be scoped' | |
43 | -# assert_not_nil assigns(:tags) | |
44 | -# assert_not_nil assigns(:pending_tags) | |
45 | -# end | |
46 | -# | |
47 | -# def test_new | |
48 | -# get :new | |
49 | -# assert_response :success | |
50 | -# assert_template 'new' | |
51 | -# assert_not_nil assigns(:parent_tags) | |
52 | -# assert_not_nil assigns(:tag) | |
53 | -# end | |
54 | -# | |
55 | -# def test_create | |
56 | -# post :create, :tag => {:name => 'test_tag'} | |
57 | -# assert_response :redirect | |
58 | -# assert_redirected_to :action => 'list' | |
59 | -# assert_not_nil assigns(:tag) | |
60 | -# end | |
61 | -# | |
62 | -# def test_create_wrong | |
63 | -# post :create, :tag => {:name => ''} | |
64 | -# assert_response :success | |
65 | -# assert_template 'new' | |
66 | -# end | |
67 | -# | |
68 | -# def test_edit | |
69 | -# assert_nothing_raised { Tag.find(1) } | |
70 | -# get :edit, :id => 1 | |
71 | -# assert assigns(:tag) | |
72 | -# assert assigns(:parent_tags) | |
73 | -# end | |
74 | -# | |
75 | -# def test_update | |
76 | -# assert_nothing_raised { Tag.find(1) } | |
77 | -# post :update, :id => 1, :tag => {:name => 'altered_tag'} | |
78 | -# assert_response :redirect | |
79 | -# assert_redirected_to :action => 'list' | |
80 | -# assert assigns(:tag) | |
81 | -# end | |
82 | -# | |
83 | -# def test_update_wrong | |
84 | -# assert_nothing_raised { Tag.find(1) } | |
85 | -# post :update, :id => 1, :tag => {:name => ''} | |
86 | -# assert_response :success | |
87 | -# assert_template 'edit' | |
88 | -# assert assigns(:parent_tags) | |
89 | -# end | |
90 | -# | |
91 | -# def test_destroy | |
92 | -# assert_nothing_raised { Tag.find(1) } | |
93 | -# post :destroy, :id => 1 | |
94 | -# assert_response :redirect | |
95 | -# assert_redirected_to :action => 'list' | |
96 | -# assert_not_nil flash[:notice] | |
97 | -# assert_raise(ActiveRecord::RecordNotFound) { Tag.find(1) } | |
98 | -# end | |
99 | -# | |
100 | -# def test_approve | |
101 | -# assert_nothing_raised { Tag.find_with_pendings(4) } | |
102 | -# assert Tag.find_with_pendings(4).pending? | |
103 | -# post :approve, :id => 4 | |
104 | -# assert_response :redirect | |
105 | -# assert_redirected_to :action => 'list' | |
106 | -# assert ( not Tag.find_with_pendings(4).pending? ) | |
107 | -# end | |
14 | + fixtures :tags, :users, :blocks, :profiles, :virtual_communities, :boxes, :domains | |
15 | + def setup | |
16 | + @controller = ManageTagsController.new | |
17 | + @request = ActionController::TestRequest.new | |
18 | + @response = ActionController::TestResponse.new | |
19 | + end | |
20 | + | |
21 | + def test_get_index | |
22 | + get :index | |
23 | + assert_response :redirect | |
24 | + assert_redirected_to :action => 'list' | |
25 | + end | |
26 | + | |
27 | + def test_list | |
28 | + get :list | |
29 | + assert_response :success | |
30 | + assert_template 'list' | |
31 | + assert_not_nil assigns(:tags) | |
32 | + assert_not_nil assigns(:pending_tags) | |
33 | + assert_nil assigns(:parent), 'the list should not scoped' | |
34 | + end | |
35 | + | |
36 | + def test_scoped_list | |
37 | + assert_nothing_raised { Tag.find(1) } | |
38 | + get :list, :parent => Tag.find(1) | |
39 | + assert_response :success | |
40 | + assert_template 'list' | |
41 | + assert_not_nil assigns(:parent), 'the list should be scoped' | |
42 | + assert_not_nil assigns(:tags) | |
43 | + assert_not_nil assigns(:pending_tags) | |
44 | + end | |
45 | + | |
46 | + def test_new | |
47 | + get :new | |
48 | + assert_response :success | |
49 | + assert_template 'new' | |
50 | + assert_not_nil assigns(:parent_tags) | |
51 | + assert_not_nil assigns(:tag) | |
52 | + end | |
53 | + | |
54 | + def test_create | |
55 | + post :create, :tag => {:name => 'test_tag'} | |
56 | + assert_response :redirect | |
57 | + assert_redirected_to :action => 'list' | |
58 | + assert_not_nil assigns(:tag) | |
59 | + end | |
60 | + | |
61 | + def test_create_wrong | |
62 | + post :create, :tag => {:name => ''} | |
63 | + assert_response :success | |
64 | + assert_template 'new' | |
65 | + end | |
66 | + | |
67 | + def test_edit | |
68 | + assert_nothing_raised { Tag.find(1) } | |
69 | + get :edit, :id => 1 | |
70 | + assert assigns(:tag) | |
71 | + assert assigns(:parent_tags) | |
72 | + end | |
73 | + | |
74 | + def test_update | |
75 | + assert_nothing_raised { Tag.find(1) } | |
76 | + post :update, :id => 1, :tag => {:name => 'altered_tag'} | |
77 | + assert_response :redirect | |
78 | + assert_redirected_to :action => 'list' | |
79 | + assert assigns(:tag) | |
80 | + end | |
81 | + | |
82 | + def test_update_wrong | |
83 | + assert_nothing_raised { Tag.find(1) } | |
84 | + post :update, :id => 1, :tag => {:name => ''} | |
85 | + assert_response :success | |
86 | + assert_template 'edit' | |
87 | + assert assigns(:parent_tags) | |
88 | + end | |
89 | + | |
90 | + def test_destroy | |
91 | + assert_nothing_raised { Tag.find(1) } | |
92 | + post :destroy, :id => 1 | |
93 | + assert_response :redirect | |
94 | + assert_redirected_to :action => 'list' | |
95 | + assert_not_nil flash[:notice] | |
96 | + assert_raise(ActiveRecord::RecordNotFound) { Tag.find(1) } | |
97 | + end | |
98 | + | |
99 | + def test_approve | |
100 | + assert_nothing_raised { Tag.find_with_pendings(4) } | |
101 | + assert Tag.find_with_pendings(4).pending? | |
102 | + post :approve, :id => 4 | |
103 | + assert_response :redirect | |
104 | + assert_redirected_to :action => 'list' | |
105 | + assert ( not Tag.find_with_pendings(4).pending? ) | |
106 | + end | |
108 | 107 | end | ... | ... |