FileTree: Allow output as hash, convert to JSON separately

This commit is contained in:
Sebastian Serth
2022-10-04 15:12:18 +02:00
committed by Sebastian Serth
parent ad8743a7d0
commit fb9672c7a4
5 changed files with 12 additions and 8 deletions

View File

@ -180,8 +180,8 @@ describe FileTree do
end
end
describe '#to_js_tree' do
let(:js_tree) { file_tree.to_js_tree }
describe '#to_js_tree_in_json' do
let(:js_tree) { file_tree.to_js_tree_in_json }
it 'returns a String' do
expect(js_tree).to be_a(String)
@ -196,7 +196,7 @@ describe FileTree do
context 'with files' do
let(:files) { build_list(:file, 10, context: nil, path: 'foo/bar/baz') }
let(:file_tree) { described_class.new(files) }
let(:js_tree) { file_tree.to_js_tree }
let(:js_tree) { file_tree.to_js_tree_in_json }
it 'produces the required JSON format with a file' do
# We ignore the root node and only use the children here