Update MenuHelper legacy spec for Nokogiri switch

Rails Dom Testing now uses Nokogiri.

Signed-off-by: Alex Coles <alex@alexbcoles.com>
pull/3421/head
Alex Coles 9 years ago
parent f22bfb1ef0
commit 0da2bd7a4c
  1. 12
      spec/legacy/unit/lib/redmine/menu_manager/menu_helper_spec.rb

@ -35,7 +35,7 @@ describe Redmine::MenuManager::MenuHelper, type: :helper do
# Used by assert_select # Used by assert_select
def html_document def html_document
HTML::Document.new(@response.body) Nokogiri::HTML(@response.body)
end end
before do before do
@ -70,7 +70,7 @@ describe Redmine::MenuManager::MenuHelper, type: :helper do
node = Redmine::MenuManager::MenuItem.new(:testing, '/test', {}) node = Redmine::MenuManager::MenuItem.new(:testing, '/test', {})
@response.body = render_single_menu_node(node, 'This is a test', node.url, false) @response.body = render_single_menu_node(node, 'This is a test', node.url, false)
html_node = HTML::Document.new(@response.body) html_node = Nokogiri::HTML(@response.body)
assert_select(html_node.root, 'a.testing-menu-item', 'This is a test') assert_select(html_node.root, 'a.testing-menu-item', 'This is a test')
end end
@ -78,7 +78,7 @@ describe Redmine::MenuManager::MenuHelper, type: :helper do
single_node = Redmine::MenuManager::MenuItem.new(:single_node, '/test', {}) single_node = Redmine::MenuManager::MenuItem.new(:single_node, '/test', {})
@response.body = render_menu_node(single_node, nil) @response.body = render_menu_node(single_node, nil)
html_node = HTML::Document.new(@response.body) html_node = Nokogiri::HTML(@response.body)
assert_select(html_node.root, 'li') do assert_select(html_node.root, 'li') do
assert_select('a.single-node-menu-item', 'Single node') assert_select('a.single-node-menu-item', 'Single node')
end end
@ -94,7 +94,7 @@ describe Redmine::MenuManager::MenuHelper, type: :helper do
@response.body = render_menu_node(parent_node, nil) @response.body = render_menu_node(parent_node, nil)
html_node = HTML::Document.new(@response.body) html_node = Nokogiri::HTML(@response.body)
assert_select(html_node.root, 'li') do assert_select(html_node.root, 'li') do
assert_select('a.parent-node-menu-item', 'Parent node') assert_select('a.parent-node-menu-item', 'Parent node')
assert_select('ul') do assert_select('ul') do
@ -128,7 +128,7 @@ describe Redmine::MenuManager::MenuHelper, type: :helper do
) )
@response.body = render_menu_node(parent_node, Project.find(1)) @response.body = render_menu_node(parent_node, Project.find(1))
html_node = HTML::Document.new(@response.body) html_node = Nokogiri::HTML(@response.body)
assert_select(html_node.root, 'li') do assert_select(html_node.root, 'li') do
assert_select('a.parent-node-menu-item', 'Parent node') assert_select('a.parent-node-menu-item', 'Parent node')
assert_select('ul') do assert_select('ul') do
@ -168,7 +168,7 @@ describe Redmine::MenuManager::MenuHelper, type: :helper do
@response.body = render_menu_node(parent_node, Project.find(1)) @response.body = render_menu_node(parent_node, Project.find(1))
html_node = HTML::Document.new(@response.body) html_node = Nokogiri::HTML(@response.body)
assert_select(html_node.root, 'li') do assert_select(html_node.root, 'li') do
assert_select('a.parent-node-menu-item', 'Parent node') assert_select('a.parent-node-menu-item', 'Parent node')
assert_select('ul') do assert_select('ul') do

Loading…
Cancel
Save