Update usage of RubyTree to avoid deprecated methods

This commit is contained in:
Sebastian Serth
2022-06-27 12:04:11 +02:00
parent 3b29c7e521
commit d3f283c4e7
2 changed files with 4 additions and 4 deletions

View File

@ -45,8 +45,8 @@ class FileTree
icon: node_icon(node),
id: node.content.try(:ancestor_id),
state: {
disabled: !node.is_leaf?,
opened: !node.is_leaf?,
disabled: !node.leaf?,
opened: !node.leaf?,
},
text: node.name,
}
@ -54,7 +54,7 @@ class FileTree
private :map_to_js_tree
def node_icon(node)
if node.is_leaf? && !node.is_root?
if node.leaf? && !node.root?
file_icon(node.content)
else
folder_icon

View File

@ -90,7 +90,7 @@ describe FileTree do
end
it 'creates tree nodes for intermediary path segments' do
expect(file_tree.instance_variable_get(:@root).reject(&:content).reject(&:is_root?).map(&:name)).to eq(files.first.path.split('/'))
expect(file_tree.instance_variable_get(:@root).reject(&:content).reject(&:root?).map(&:name)).to eq(files.first.path.split('/'))
end
end