Commit 9a7bbdf2b04e1240426605fbdbc3ce40ba008330

Authored by Rodrigo Souto
1 parent 71d849ce

[plugins-tests] Fixing display_content tests

plugins/display_content/test/functional/display_content_plugin_admin_controller_test.rb
@@ -41,7 +41,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase @@ -41,7 +41,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase
41 Article.delete_all 41 Article.delete_all
42 get :index, :block_id => block.id 42 get :index, :block_id => block.id
43 json_response = ActiveSupport::JSON.decode(@response.body) 43 json_response = ActiveSupport::JSON.decode(@response.body)
44 - assert_equal [], json_response 44 + assert_equivalent [], json_response
45 end 45 end
46 46
47 should 'index action returns an json with node content' do 47 should 'index action returns an json with node content' do
@@ -53,7 +53,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase @@ -53,7 +53,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase
53 expected_json = {'data' => article.title} 53 expected_json = {'data' => article.title}
54 expected_json['attr'] = { 'node_id' => article.id, 'parent_id' => article.parent_id} 54 expected_json['attr'] = { 'node_id' => article.id, 'parent_id' => article.parent_id}
55 55
56 - assert_equal [expected_json], json_response 56 + assert_equivalent [expected_json], json_response
57 end 57 end
58 58
59 should 'index action returns an json with node checked if the node is in the nodes list' do 59 should 'index action returns an json with node checked if the node is in the nodes list' do
@@ -68,7 +68,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase @@ -68,7 +68,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase
68 expected_json['attr'] = { 'node_id' => article.id, 'parent_id' => article.parent_id} 68 expected_json['attr'] = { 'node_id' => article.id, 'parent_id' => article.parent_id}
69 expected_json['attr'].merge!({'class' => 'jstree-checked'}) 69 expected_json['attr'].merge!({'class' => 'jstree-checked'})
70 70
71 - assert_equal [expected_json], json_response 71 + assert_equivalent [expected_json], json_response
72 end 72 end
73 73
74 should 'index action returns an json with node undetermined if the node is in the parent nodes list' do 74 should 'index action returns an json with node undetermined if the node is in the parent nodes list' do
@@ -84,7 +84,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase @@ -84,7 +84,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase
84 expected_json['attr'].merge!({'class' => 'jstree-undetermined'}) 84 expected_json['attr'].merge!({'class' => 'jstree-undetermined'})
85 expected_json['children'] = [] 85 expected_json['children'] = []
86 86
87 - assert_equal [expected_json], json_response 87 + assert_equivalent [expected_json], json_response
88 end 88 end
89 89
90 should 'index action returns an json with node closed if the node has article with children' do 90 should 'index action returns an json with node closed if the node has article with children' do
@@ -98,7 +98,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase @@ -98,7 +98,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase
98 expected_json['attr'] = { 'node_id' => f.id, 'parent_id' => f.parent_id} 98 expected_json['attr'] = { 'node_id' => f.id, 'parent_id' => f.parent_id}
99 expected_json['state'] = 'closed' 99 expected_json['state'] = 'closed'
100 100
101 - assert_equal [expected_json], json_response 101 + assert_equivalent [expected_json], json_response
102 end 102 end
103 103
104 should 'index action returns an json with all the children nodes if some parent is in the parents list' do 104 should 'index action returns an json with all the children nodes if some parent is in the parents list' do
@@ -121,7 +121,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase @@ -121,7 +121,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase
121 expected_json['children'] = children 121 expected_json['children'] = children
122 expected_json['state'] = 'closed' 122 expected_json['state'] = 'closed'
123 123
124 - assert_equal [expected_json], json_response 124 + assert_equivalent [expected_json], json_response
125 end 125 end
126 126
127 should 'index action returns an json with all the children nodes and root nodes if some parent is in the parents list and there is others root articles' do 127 should 'index action returns an json with all the children nodes and root nodes if some parent is in the parents list and there is others root articles' do
@@ -151,7 +151,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase @@ -151,7 +151,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase
151 value['attr'] = { 'node_id' => a3.id, 'parent_id' => a3.parent_id} 151 value['attr'] = { 'node_id' => a3.id, 'parent_id' => a3.parent_id}
152 expected_json.push(value) 152 expected_json.push(value)
153 153
154 - assert_equal expected_json, json_response 154 + assert_equivalent expected_json, json_response
155 end 155 end
156 156
157 should 'index action returns an json without children nodes if the parent is not in the parents list' do 157 should 'index action returns an json without children nodes if the parent is not in the parents list' do
@@ -173,7 +173,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase @@ -173,7 +173,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase
173 value['attr'] = { 'node_id' => a3.id, 'parent_id' => a3.parent_id} 173 value['attr'] = { 'node_id' => a3.id, 'parent_id' => a3.parent_id}
174 expected_json.push(value) 174 expected_json.push(value)
175 175
176 - assert_equal expected_json, json_response 176 + assert_equivalent expected_json, json_response
177 end 177 end
178 178
179 end 179 end
plugins/display_content/test/functional/display_content_plugin_myprofile_controller_test.rb
@@ -41,7 +41,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase @@ -41,7 +41,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase
41 Article.delete_all 41 Article.delete_all
42 get :index, :block_id => block.id, :profile => profile.identifier 42 get :index, :block_id => block.id, :profile => profile.identifier
43 json_response = ActiveSupport::JSON.decode(@response.body) 43 json_response = ActiveSupport::JSON.decode(@response.body)
44 - assert_equal [], json_response 44 + assert_equivalent [], json_response
45 end 45 end
46 46
47 should 'index action returns an json with node content' do 47 should 'index action returns an json with node content' do
@@ -53,7 +53,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase @@ -53,7 +53,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase
53 expected_json = {'data' => article.title} 53 expected_json = {'data' => article.title}
54 expected_json['attr'] = { 'node_id' => article.id, 'parent_id' => article.parent_id} 54 expected_json['attr'] = { 'node_id' => article.id, 'parent_id' => article.parent_id}
55 55
56 - assert_equal [expected_json], json_response 56 + assert_equivalent [expected_json], json_response
57 end 57 end
58 58
59 should 'index action returns an json with node checked if the node is in the nodes list' do 59 should 'index action returns an json with node checked if the node is in the nodes list' do
@@ -68,7 +68,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase @@ -68,7 +68,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase
68 expected_json['attr'] = { 'node_id' => article.id, 'parent_id' => article.parent_id} 68 expected_json['attr'] = { 'node_id' => article.id, 'parent_id' => article.parent_id}
69 expected_json['attr'].merge!({'class' => 'jstree-checked'}) 69 expected_json['attr'].merge!({'class' => 'jstree-checked'})
70 70
71 - assert_equal [expected_json], json_response 71 + assert_equivalent [expected_json], json_response
72 end 72 end
73 73
74 should 'index action returns an json with node undetermined if the node is in the parent nodes list' do 74 should 'index action returns an json with node undetermined if the node is in the parent nodes list' do
@@ -84,7 +84,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase @@ -84,7 +84,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase
84 expected_json['attr'].merge!({'class' => 'jstree-undetermined'}) 84 expected_json['attr'].merge!({'class' => 'jstree-undetermined'})
85 expected_json['children'] = [] 85 expected_json['children'] = []
86 86
87 - assert_equal [expected_json], json_response 87 + assert_equivalent [expected_json], json_response
88 end 88 end
89 89
90 should 'index action returns an json with node closed if the node has article with children' do 90 should 'index action returns an json with node closed if the node has article with children' do
@@ -99,7 +99,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase @@ -99,7 +99,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase
99 expected_json['attr'] = { 'node_id' => f.id, 'parent_id' => f.parent_id} 99 expected_json['attr'] = { 'node_id' => f.id, 'parent_id' => f.parent_id}
100 expected_json['state'] = 'closed' 100 expected_json['state'] = 'closed'
101 101
102 - assert_equal [expected_json], json_response 102 + assert_equivalent [expected_json], json_response
103 end 103 end
104 104
105 should 'index action returns an json with all the children nodes if some parent is in the parents list' do 105 should 'index action returns an json with all the children nodes if some parent is in the parents list' do
@@ -122,7 +122,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase @@ -122,7 +122,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase
122 expected_json['children'] = children 122 expected_json['children'] = children
123 expected_json['state'] = 'closed' 123 expected_json['state'] = 'closed'
124 124
125 - assert_equal [expected_json], json_response 125 + assert_equivalent [expected_json], json_response
126 end 126 end
127 127
128 should 'index action returns an json with all the children nodes and root nodes if some parent is in the parents list and there is others root articles' do 128 should 'index action returns an json with all the children nodes and root nodes if some parent is in the parents list and there is others root articles' do
@@ -152,7 +152,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase @@ -152,7 +152,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase
152 value['attr'] = { 'node_id' => a3.id, 'parent_id' => a3.parent_id} 152 value['attr'] = { 'node_id' => a3.id, 'parent_id' => a3.parent_id}
153 expected_json.push(value) 153 expected_json.push(value)
154 154
155 - assert_equal expected_json, json_response 155 + assert_equivalent expected_json, json_response
156 end 156 end
157 157
158 should 'index action returns an json without children nodes if the parent is not in the parents list' do 158 should 'index action returns an json without children nodes if the parent is not in the parents list' do
@@ -174,7 +174,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase @@ -174,7 +174,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase
174 value['attr'] = { 'node_id' => a3.id, 'parent_id' => a3.parent_id} 174 value['attr'] = { 'node_id' => a3.id, 'parent_id' => a3.parent_id}
175 expected_json.push(value) 175 expected_json.push(value)
176 176
177 - assert_equal expected_json, json_response 177 + assert_equivalent expected_json, json_response
178 end 178 end
179 179
180 end 180 end