Sha256: 42b827b84994e63ec274f917d5b2f1f7c5d7b198848705006b3371e824e40fdc
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
# encoding: utf-8 # frozen_string_literal: true RSpec.describe TTY::Tree::Node do it "provides directory stats" do dir = fixtures_path('dir1') node = TTY::Tree::Node.new(dir, '', '', 0) expect(node.directory?).to eq(true) expect(node.file?).to eq(false) expect(node.symlink?).to eq(false) expect(node.socket?).to eq(false) expect(node.pipe?).to eq(false) end it "informs if node is hidden" do file = fixtures_path('hidden', 'dir1', '.file1.2') node = TTY::Tree::Node.new(file, '', '', 0) expect(node.hidden?).to eq(true) end it "compares two nodes for equality" do node_a = TTY::Tree::Node.new('dir1', '', '', 0) node_b = TTY::Tree::Node.new('dir1', '', '', 0) expect(node_a).to eq(node_b) end it "compares two nodes for inequlity" do node_a = TTY::Tree::Node.new('dir1', '', '', 0) node_b = TTY::Tree::Node.new('dir2', '', '', 0) expect(node_a).to_not eq(node_b) end it "strips null bytes from pathname" do node = nil expect {node = TTY::Tree::Node.new("dir1\0", '', '', 0)}.not_to raise_error expect(node.path.to_s).to eq('dir1') end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tty-tree-0.3.0 | spec/unit/node_spec.rb |