Commit fd06f9390333db9533c929fcd7c6c88b5d1ecc96
1 parent
e74f65a7
Exists in
master
and in
20 other branches
adapting tests to use nokogiri correctly
Showing
1 changed file
with
16 additions
and
16 deletions
Show diff stats
test/unit/box_organizer_helper_test.rb
... | ... | @@ -133,8 +133,8 @@ class BoxOrganizerHelperTest < ActionView::TestCase |
133 | 133 | @plugins = mock |
134 | 134 | @plugins.stubs(:fetch_first_plugin).with(:has_block?, block).returns(nil) |
135 | 135 | |
136 | - doc = HTML::Document.new display_previews(block) | |
137 | - assert_select doc.root, 'li' do |elements| | |
136 | + doc = Nokogiri::HTML display_previews(block) | |
137 | + assert_select doc, 'li' do |elements| | |
138 | 138 | assert_match /img.* src="\/images\/block_preview.png.*"/, elements[0].to_s |
139 | 139 | assert_match /img.* src="\/images\/block_preview.png.*"/, elements[1].to_s |
140 | 140 | assert_match /img.* src="\/images\/block_preview.png.*"/, elements[2].to_s |
... | ... | @@ -150,8 +150,8 @@ class BoxOrganizerHelperTest < ActionView::TestCase |
150 | 150 | Dir.stubs(:glob).returns([]) |
151 | 151 | base_path = File.join(Rails.root, 'public', 'images', '/blocks/some_block/previews/') |
152 | 152 | Dir.stubs(:glob).with(File.join(base_path, '*')).returns([File.join(base_path, 'p1.png'), File.join(base_path, 'p2.png')]) |
153 | - doc = HTML::Document.new display_previews(block) | |
154 | - assert_select doc.root, 'li' do |elements| | |
153 | + doc = Nokogiri::HTML display_previews(block) | |
154 | + assert_select doc, 'li' do |elements| | |
155 | 155 | assert_match /img.* src="\/images\/blocks\/some_block\/previews\/p1.png"/, elements[0].to_s |
156 | 156 | assert_match /img.* src="\/images\/blocks\/some_block\/previews\/p2.png"/, elements[1].to_s |
157 | 157 | end |
... | ... | @@ -169,8 +169,8 @@ class BoxOrganizerHelperTest < ActionView::TestCase |
169 | 169 | Dir.stubs(:glob).returns([]) |
170 | 170 | base_path = File.join(Rails.root, 'public', 'plugins/some/', 'images', '/blocks/some_block/previews/') |
171 | 171 | Dir.stubs(:glob).with(File.join(base_path, '*')).returns([File.join(base_path, 'p1.png'), File.join(base_path, 'p2.png')]) |
172 | - doc = HTML::Document.new display_previews(block) | |
173 | - assert_select doc.root, 'li' do |elements| | |
172 | + doc = Nokogiri::HTML display_previews(block) | |
173 | + assert_select doc, 'li' do |elements| | |
174 | 174 | assert_match /img.* src="\/plugins\/some\/images\/blocks\/some_block\/previews\/p1.png"/, elements[0].to_s |
175 | 175 | assert_match /img.* src="\/plugins\/some\/images\/blocks\/some_block\/previews\/p2.png"/, elements[1].to_s |
176 | 176 | end |
... | ... | @@ -191,8 +191,8 @@ class BoxOrganizerHelperTest < ActionView::TestCase |
191 | 191 | Dir.stubs(:glob).returns([]) |
192 | 192 | base_path = File.join(Rails.root, 'public', 'designs/themes/some_theme/', 'images', '/blocks/some_block/previews/') |
193 | 193 | Dir.stubs(:glob).with(File.join(base_path, '*')).returns([File.join(base_path, 'p1.png'), File.join(base_path, 'p2.png')]) |
194 | - doc = HTML::Document.new display_previews(block) | |
195 | - assert_select doc.root, 'li' do |elements| | |
194 | + doc = Nokogiri::HTML display_previews(block) | |
195 | + assert_select doc, 'li' do |elements| | |
196 | 196 | assert_match /img.* src="\/designs\/themes\/some_theme\/images\/blocks\/some_block\/previews\/p1.png"/, elements[0].to_s |
197 | 197 | assert_match /img.* src="\/designs\/themes\/some_theme\/images\/blocks\/some_block\/previews\/p2.png"/, elements[1].to_s |
198 | 198 | end |
... | ... | @@ -216,8 +216,8 @@ class BoxOrganizerHelperTest < ActionView::TestCase |
216 | 216 | base_path = File.join(Rails.root, 'public', 'images', '/blocks/some_block/previews/') |
217 | 217 | Dir.stubs(:glob).with(File.join(base_path, '*')).returns([File.join(base_path, 'p1.png'), File.join(base_path, 'p2.png')]) |
218 | 218 | |
219 | - doc = HTML::Document.new display_previews(block) | |
220 | - assert_select doc.root, 'li' do |elements| | |
219 | + doc = Nokogiri::HTML display_previews(block) | |
220 | + assert_select doc, 'li' do |elements| | |
221 | 221 | assert_match /img.* src="\/designs\/themes\/some_theme\/images\/blocks\/some_block\/previews\/p1.png"/, elements[0].to_s |
222 | 222 | assert_match /img.* src="\/designs\/themes\/some_theme\/images\/blocks\/some_block\/previews\/p2.png"/, elements[1].to_s |
223 | 223 | end |
... | ... | @@ -242,8 +242,8 @@ class BoxOrganizerHelperTest < ActionView::TestCase |
242 | 242 | base_path = File.join(Rails.root, 'public', 'plugins/some/', 'images', '/blocks/some_block/previews/') |
243 | 243 | Dir.stubs(:glob).with(File.join(base_path, '*')).returns([File.join(base_path, 'p1.png'), File.join(base_path, 'p2.png')]) |
244 | 244 | |
245 | - doc = HTML::Document.new display_previews(block) | |
246 | - assert_select doc.root, 'li' do |elements| | |
245 | + doc = Nokogiri::HTML display_previews(block) | |
246 | + assert_select doc, 'li' do |elements| | |
247 | 247 | assert_match /img.* src="\/designs\/themes\/some_theme\/images\/blocks\/some_block\/previews\/p1.png"/, elements[0].to_s |
248 | 248 | assert_match /img.* src="\/designs\/themes\/some_theme\/images\/blocks\/some_block\/previews\/p2.png"/, elements[1].to_s |
249 | 249 | end |
... | ... | @@ -273,8 +273,8 @@ class BoxOrganizerHelperTest < ActionView::TestCase |
273 | 273 | base_path = File.join(Rails.root, 'public', 'images', '/blocks/some_block/previews/') |
274 | 274 | Dir.stubs(:glob).with(File.join(base_path, '*')).returns([File.join(base_path, 'p1.png'), File.join(base_path, 'p2.png')]) |
275 | 275 | |
276 | - doc = HTML::Document.new display_previews(block) | |
277 | - assert_select doc.root, 'li' do |elements| | |
276 | + doc = Nokogiri::HTML display_previews(block) | |
277 | + assert_select doc, 'li' do |elements| | |
278 | 278 | assert_match /img.* src="\/designs\/themes\/some_theme\/images\/blocks\/some_block\/previews\/p1.png"/, elements[0].to_s |
279 | 279 | assert_match /img.* src="\/designs\/themes\/some_theme\/images\/blocks\/some_block\/previews\/p2.png"/, elements[1].to_s |
280 | 280 | end |
... | ... | @@ -300,8 +300,8 @@ class BoxOrganizerHelperTest < ActionView::TestCase |
300 | 300 | base_path = File.join(Rails.root, 'public', 'images', '/blocks/some_block/previews/') |
301 | 301 | Dir.stubs(:glob).with(File.join(base_path, '*')).returns([File.join(base_path, 'p1.png'), File.join(base_path, 'p2.png')]) |
302 | 302 | |
303 | - doc = HTML::Document.new display_previews(block) | |
304 | - assert_select doc.root, 'li' do |elements| | |
303 | + doc = Nokogiri::HTML display_previews(block) | |
304 | + assert_select doc, 'li' do |elements| | |
305 | 305 | assert_match /img.* src="\/plugins\/some\/images\/blocks\/some_block\/previews\/p1.png"/, elements[0].to_s |
306 | 306 | assert_match /img.* src="\/plugins\/some\/images\/blocks\/some_block\/previews\/p2.png"/, elements[1].to_s |
307 | 307 | end | ... | ... |