tree.rb 0.3.12 → 0.3.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +7 -0
  2. data/.gemtest +0 -0
  3. data/LICENSE.txt +0 -0
  4. data/README.md +0 -0
  5. data/Rakefile +0 -0
  6. data/examples/d3js_layout_partition/data.js +0 -0
  7. data/examples/d3js_layout_partition/index.html +0 -0
  8. data/examples/d3js_layout_partition/run.sh +0 -0
  9. data/examples/d3js_layout_partition/style.css +0 -0
  10. data/examples/d3js_layout_treemap/data.js +0 -0
  11. data/examples/d3js_layout_treemap/index.html +0 -0
  12. data/examples/d3js_layout_treemap/run.sh +0 -0
  13. data/examples/d3js_layout_treemap/style.css +0 -0
  14. data/examples/protovis/directory_to_json_visitor.rb +0 -0
  15. data/examples/protovis/index.html +0 -0
  16. data/examples/protovis/protovis-r3.2.js +0 -0
  17. data/examples/protovis/treevisitor.js +0 -0
  18. data/examples/protovis/treevisitor.png +0 -0
  19. data/examples/ruby_examples/find_directory_without_subdirectory.rb +2 -2
  20. data/examples/ruby_examples/find_files.rb +0 -0
  21. data/examples/ruby_examples/find_orphan_xmp.rb +17 -0
  22. data/examples/ruby_examples/print_files.rb +1 -2
  23. data/ext/mkrf_conf.rb +3 -2
  24. data/lib/colors.rb +39 -0
  25. data/lib/tree_rb.rb +2 -2
  26. data/lib/tree_rb/cli/cli_json.rb +3 -3
  27. data/lib/tree_rb/cli/cli_tree.rb +0 -0
  28. data/lib/tree_rb/core/abs_node.rb +2 -2
  29. data/lib/tree_rb/core/basic_tree_node_visitor.rb +0 -0
  30. data/lib/tree_rb/core/leaf_node.rb +0 -0
  31. data/lib/tree_rb/core/tree_node.rb +0 -0
  32. data/lib/tree_rb/core/tree_node_visitor.rb +0 -0
  33. data/lib/tree_rb/exception.rb +0 -0
  34. data/lib/tree_rb/extension_digest.rb +0 -0
  35. data/lib/tree_rb/extension_numeric.rb +0 -0
  36. data/lib/tree_rb/input_plugins/file_system/dir_processor.rb +0 -0
  37. data/lib/tree_rb/input_plugins/file_system/directory_walker.rb +3 -3
  38. data/lib/tree_rb/input_plugins/html_page/dom_walker.rb +0 -0
  39. data/lib/tree_rb/output_plugins/dircat/dircat_output.rb +0 -0
  40. data/lib/tree_rb/output_plugins/dircat/dircat_visitor.rb +0 -0
  41. data/lib/tree_rb/output_plugins/dircat/entry.rb +0 -0
  42. data/lib/tree_rb/output_plugins/html/d3js_output.rb +0 -0
  43. data/lib/tree_rb/output_plugins/html/directory_to_hash2_visitor.rb +0 -0
  44. data/lib/tree_rb/output_plugins/html/erb_render.rb +0 -0
  45. data/lib/tree_rb/output_plugins/sqlite/sqlite_dir_tree_visitor.rb +0 -0
  46. data/lib/tree_rb/output_plugins/sqlite/sqlite_output.rb +0 -0
  47. data/lib/tree_rb/version.rb +1 -1
  48. data/lib/tree_rb/visitors/block_tree_node_visitor.rb +0 -0
  49. data/lib/tree_rb/visitors/callback_tree_node_visitor2.rb +2 -2
  50. data/lib/tree_rb/visitors/clone_tree_node_visitor.rb +0 -0
  51. data/lib/tree_rb/visitors/depth_tree_node_visitor.rb +0 -0
  52. data/lib/tree_rb/visitors/flat_print_tree_node_visitor.rb +0 -0
  53. data/lib/tree_rb/visitors/print_dir_tree_visitor.rb +0 -0
  54. data/lib/tree_rb/visitors/print_tree_node_visitor.rb +0 -0
  55. data/lib/tree_rb/visitors_file_system/build_dir_tree_visitor.rb +0 -0
  56. data/lib/tree_rb/visitors_file_system/directory_to_hash_visitor.rb +0 -0
  57. data/lib/tree_rb_cli.rb +0 -0
  58. data/lib/tree_visitor.rb +0 -0
  59. data/lib/treevisitor.rb +0 -0
  60. data/lib/treevisitor_cli.rb +0 -0
  61. data/spec/fixtures/html_pages/test_1.html +0 -0
  62. data/spec/fixtures/test_dir_1/.dir_with_dot/dummy.txt +0 -0
  63. data/spec/fixtures/test_dir_1/dir.1/dir.1.2/file.1.2.1 +0 -0
  64. data/spec/fixtures/test_dir_1/dir.1/file.1.1 +0 -0
  65. data/spec/fixtures/test_dir_1/dir.2/file.2.1 +0 -0
  66. data/spec/fixtures/test_dir_2/[Dsube]/sub/.gitkeep +0 -0
  67. data/spec/fixtures/test_json/1.json +0 -0
  68. data/spec/fixtures/test_orphaned_xmp/img_001.jpg +0 -0
  69. data/spec/fixtures/test_orphaned_xmp/img_001.xmp +0 -0
  70. data/spec/fixtures/test_orphaned_xmp/img_002.xmp +0 -0
  71. data/spec/spec_helper.rb +2 -0
  72. data/spec/tree_rb/cli/cli_json_spec.rb +3 -3
  73. data/spec/tree_rb/cli/cli_tree_d3js_spec.rb +3 -3
  74. data/spec/tree_rb/cli/cli_tree_digest_spec.rb +2 -2
  75. data/spec/tree_rb/cli/cli_tree_generic_spec.rb +15 -15
  76. data/spec/tree_rb/cli/cli_tree_sqlite_spec.rb +2 -2
  77. data/spec/tree_rb/core/tree_dsl_spec.rb +3 -3
  78. data/spec/tree_rb/core/tree_dsl_with_derived_class1_spec.rb +1 -1
  79. data/spec/tree_rb/core/tree_dsl_with_derived_class_spec.rb +2 -2
  80. data/spec/tree_rb/core/tree_node_paths_spec.rb +25 -25
  81. data/spec/tree_rb/core/tree_node_spec.rb +41 -41
  82. data/spec/tree_rb/core/tree_node_visitor_delegate_spec.rb +3 -3
  83. data/spec/tree_rb/core/tree_node_visitor_dsl_spec.rb +13 -13
  84. data/spec/tree_rb/extension_digest_spec.rb +6 -7
  85. data/spec/tree_rb/extension_numeric_spec.rb +3 -3
  86. data/spec/tree_rb/input_file_system/dir_processor_spec.rb +2 -2
  87. data/spec/tree_rb/input_file_system/directory_walker_conf_spec.rb +59 -59
  88. data/spec/tree_rb/input_file_system/directory_walker_run_spec.rb +73 -62
  89. data/spec/tree_rb/input_html_page/dom_walker_spec.rb +12 -3
  90. data/spec/tree_rb/visitors/block_tree_node_visitor_spec.rb +2 -2
  91. data/spec/tree_rb/visitors/callback_tree_node_visitor2_spec.rb +3 -3
  92. data/spec/tree_rb/visitors/depth_tree_node_visitor_spec.rb +2 -2
  93. data/spec/tree_rb/visitors/tree_node_visitors_spec.rb +2 -2
  94. data/tasks/rspec.rake +1 -1
  95. data/tasks/tree_rb.rake +0 -0
  96. data/tasks/yard.rake +0 -0
  97. data/tree.rb.gemspec +3 -2
  98. metadata +99 -87
  99. data/spec/fixtures/tmp/test.db +0 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 037bf51f0b4d7686237af3731ee0a1f61daef2fb
4
+ data.tar.gz: 2a527f8e2cb669fe76a4aed27a997c43578b21cc
5
+ SHA512:
6
+ metadata.gz: d028765225493c73d8ab7c62953d95aa933bdab6368312431f20ec142c2be19eb5fc2de61a8a3f15fa8b9878448feb7f17f282dbfd01c650ad85a1bb8850c01d
7
+ data.tar.gz: 21aec5481901641e646d0cbe09b5d93b16ab436a699a81f348c6341314ca45fbc4d1dcf3e33761c83ea8b7354afe11c0bc078c46978114aaf7dc96f5e0430905
data/.gemtest CHANGED
File without changes
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -25,13 +25,13 @@ class DirWithoutSubDir < TreeRb::BasicTreeNodeVisitor
25
25
  def exit_node( pathname )
26
26
  info = @stack.pop
27
27
  if info.nr == @nr
28
- puts "leaf: #{pathname}"
28
+ puts "leaf: #{pathname} with no subdir"
29
29
  end
30
30
  end
31
31
 
32
32
  end
33
33
 
34
- dtw = TreeRb::DirTreeWalker.new( File.join('..', '..'))
34
+ dtw = TreeRb::DirTreeWalker.new( File.join('..', '..') )
35
35
  dtw.ignore /^\./
36
36
  dtw.visit_file=false
37
37
  dtw.run( DirWithoutSubDir.new )
File without changes
@@ -0,0 +1,17 @@
1
+ # -*- coding: utf-8 -*-
2
+ cwd = File.expand_path( File.join( File.dirname(__FILE__), '..', '..', 'lib') )
3
+ $:.unshift(cwd) unless $:.include?(cwd)
4
+ require 'tree_rb'
5
+ include TreeRb
6
+
7
+ root_dir = File.expand_path( File.join( cwd, '..', 'spec', 'fixtures', 'test_orphaned_xmp' ) )
8
+
9
+ puts "*** print all xmp files starting from '#{root_dir}'"
10
+ dtw = DirTreeWalker.new( :match => /.xmp/ )
11
+ dtw.run root_dir do
12
+ on_leaf do |pathname|
13
+ puts "- #{pathname}"
14
+ end
15
+
16
+ on_enter_node
17
+ end
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- cwd = File.expand_path( File.join( File.dirname(__FILE__), "..", "..", "lib" ) )
2
+ cwd = File.expand_path( File.join( File.dirname(__FILE__), '..', '..', 'lib') )
3
3
  $:.unshift(cwd) unless $:.include?(cwd)
4
4
  require 'tree_rb'
5
5
  include TreeRb
@@ -15,7 +15,6 @@ dtw.run root_dir do
15
15
  end
16
16
 
17
17
  puts '*** print files with extension *.sh" and "*.js"'
18
- #dtw = DirTreeWalker.new( :match => %w(/.sh/ /.jd/) )
19
18
  dtw = DirTreeWalker.new( :match => /.sh/ )
20
19
  dtw.run root_dir do
21
20
  on_leaf do |pathname|
@@ -11,13 +11,14 @@ end
11
11
  inst = Gem::DependencyInstaller.new
12
12
  begin
13
13
  if RUBY_PLATFORM =~ /win32/
14
- inst.install "win32console"
14
+ inst.install 'win32console'
15
15
  end
16
16
  rescue
17
17
  exit(1)
18
18
  end
19
19
 
20
- f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w") # create dummy rakefile to indicate success
20
+ # create dummy rakefile to indicate success
21
+ f = File.open(File.join(File.dirname(__FILE__), 'Rakefile'), 'w')
21
22
  f.write("task :default\n")
22
23
  f.close
23
24
 
@@ -0,0 +1,39 @@
1
+ # Below are the color init strings for the basic file types. A color init
2
+ # string consists of one or more of the following numeric codes:
3
+ # Attribute codes:
4
+ # 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
5
+ # Text color codes:
6
+ # 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
7
+ # Background color codes:
8
+ # 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
9
+
10
+
11
+ m = { }
12
+ ENV['LS_COLORS'].split(":").each do |e|
13
+ k, v = e.split('=')
14
+ m[k] = v
15
+ end
16
+
17
+ puts m
18
+
19
+
20
+ ## ANSIname => ANSIcode LUT
21
+ #ANSINAME2CODE= { "reset" => "\e[0m", "bold" => "\e[1m",
22
+ # "underline" => "\e[4m", "blink" => "\e[5m",
23
+ # "reverse" => "\e[7m", "invisible" => "\e[8m",
24
+ # "black" => "\e[0;30m", "darkgrey" => "\e[1;30m",
25
+ # "red" => "\e[0;31m", "lightred" => "\e[1;31m",
26
+ # "green" => "\e[0;32m", "lightgreen" => "\e[1;32m",
27
+ # "brown" => "\e[0;33m", "yellow" => "\e[1;33m",
28
+ # "blue" => "\e[0;34m", "lightblue" => "\e[1;34m",
29
+ # "purple" => "\e[0;35m", "magenta" => "\e[1;35m",
30
+ # "cyan" => "\e[1;36m", "lightcyan" => "\e[1;36m",
31
+ # "grey" => "\e[0;37m", "white" => "\e[1;37m",
32
+ # "bgblack" => "\e[40m", "bgred" => "\e[41m",
33
+ # "bggreen" => "\e[42m", "bgyellow" => "\e[43m",
34
+ # "bgblue" => "\e[44m", "bgmagenta" => "\e[45m",
35
+ # "bgcyan" => "\e[46m", "bgwhite" => "\e[47m"
36
+ i,e= m['*.tga'].split(';')
37
+
38
+ puts "\e[#{i}m\e[1;#{e}m prova.tga \e[0m"
39
+
@@ -17,7 +17,7 @@ require 'ansi/code'
17
17
  begin
18
18
  require 'Win32/Console/ANSI' if RUBY_PLATFORM =~ /win32/
19
19
  rescue LoadError
20
- puts 'You must gem install win32console to use color on Windows'
20
+ puts "to use color on Windows you can install win32console 'gem install win32console'"
21
21
  end
22
22
 
23
23
  #
@@ -44,7 +44,7 @@ require 'tree_rb/input_plugins/html_page/dom_walker'
44
44
  # visitors
45
45
  #
46
46
 
47
- visitors_dir = File.join(File.dirname(__FILE__), "tree_rb", "visitors")
47
+ visitors_dir = File.join(File.dirname(__FILE__), 'tree_rb', 'visitors')
48
48
  unless Dir.exist? visitors_dir
49
49
  raise "cannot found directory '#{visitors_dir}'"
50
50
  end
@@ -15,11 +15,11 @@ module TreeRb
15
15
 
16
16
  def options_parser(options)
17
17
  parser = OptionParser.new
18
- parser.banner = "Usage: rjson.rb [options] [directory]"
18
+ parser.banner = 'Usage: rjson.rb [options] [directory]'
19
19
  parser.separator 'pretty format json file'
20
20
  parser.separator 'Code https://github.com/tokiro/treevisitor. Feedback to tokiro.oyama@gmail.com'
21
21
 
22
- parser.on('-o [FILE]', "--output [FILE]", String) do |v|
22
+ parser.on('-o [FILE]', '--output [FILE]', String) do |v|
23
23
  if options[:output]
24
24
  puts 'only one file of output can be used'
25
25
  options[:exit] = true
@@ -28,7 +28,7 @@ module TreeRb
28
28
  end
29
29
 
30
30
  options[:force_overwrite_output] = false
31
- parser.on("--force", "overwrite output") do
31
+ parser.on('--force', 'overwrite output') do
32
32
  options[:force_overwrite_output] = true
33
33
  end
34
34
  parser.on_tail('--help', 'Show this message') do
File without changes
@@ -64,12 +64,12 @@ module TreeRb
64
64
  # Root node could have assigned a path
65
65
  #
66
66
  def prefix_path
67
- raise "Not root!!" unless @parent.nil?
67
+ raise 'Not root!!' unless @parent.nil?
68
68
  @prefix_path
69
69
  end
70
70
 
71
71
  def prefix_path=(prefix)
72
- raise "Not root!!" unless @parent.nil?
72
+ raise 'Not root!!' unless @parent.nil?
73
73
  if prefix != @prefix_path
74
74
  @prefix_path = prefix
75
75
  if prefix and prefix !~ /\/$/
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -162,7 +162,7 @@ module TreeRb
162
162
  # @return [boolean] if dirname match almost one pattern
163
163
  #
164
164
  def ignore_dir?(dirname)
165
- _include?(@ignore_dir_patterns, File.basename(dirname))
165
+ _include?(@ignore_dir_patterns, File.basename(dirname)) != nil
166
166
  end
167
167
 
168
168
  #
@@ -172,7 +172,7 @@ module TreeRb
172
172
  # @return [boolean] if filename match almost one pattern
173
173
  #
174
174
  def ignore_file?(filename)
175
- _include?(@ignore_file_patterns, File.basename(filename))
175
+ _include?(@ignore_file_patterns, File.basename(filename)) != nil
176
176
  end
177
177
 
178
178
  #
@@ -183,7 +183,7 @@ module TreeRb
183
183
  #
184
184
  def match?(filename)
185
185
  return true if @match_file_patterns.empty?
186
- _include?(@match_file_patterns, File.basename(filename))
186
+ _include?(@match_file_patterns, File.basename(filename)) != nil
187
187
  end
188
188
 
189
189
  #
@@ -1,4 +1,4 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  module TreeRb
3
- VERSION='0.3.12'
3
+ VERSION='0.3.13'
4
4
  end
@@ -16,12 +16,12 @@ module TreeRb
16
16
  end
17
17
 
18
18
  def on_enter_node(&block)
19
- raise "already defined a delegate" if @delegate
19
+ raise 'already defined a delegate' if @delegate
20
20
  @action_enter_tree_node = block
21
21
  end
22
22
 
23
23
  def on_visit_leaf(&block)
24
- raise "already defined a delegate" if @delegate
24
+ raise 'already defined a delegate' if @delegate
25
25
  @action_visit_leaf_node = block
26
26
  end
27
27
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -5,6 +5,8 @@
5
5
  require 'stringio'
6
6
  require 'ostruct'
7
7
 
8
+ require 'rspec/collection_matchers'
9
+
8
10
  #
9
11
  # gem
10
12
  #
@@ -9,7 +9,7 @@ describe CliJson do
9
9
  # args << File.join(FIXTURES, "test_dir_1")
10
10
  CliJson.new.parse_args(args)
11
11
  end
12
- captured.out.should match /Usage:/
12
+ expect(captured.out).to match /Usage:/
13
13
  end
14
14
 
15
15
  it 'should accept --version switch' do
@@ -18,7 +18,7 @@ describe CliJson do
18
18
  CliJson.new.parse_args(args)
19
19
  end
20
20
  version = TreeRb::VERSION
21
- captured.out.should match version
21
+ expect(captured.out).to match version
22
22
  end
23
23
 
24
24
  it 'should format simple json file' do
@@ -34,7 +34,7 @@ describe CliJson do
34
34
  "b": 2
35
35
  }
36
36
  EOS
37
- captured.out.should == certified_out
37
+ expect(captured.out).to be == certified_out
38
38
  end
39
39
 
40
40
  end
@@ -9,7 +9,7 @@ describe CliTree do
9
9
  args << File.join(FIXTURES, "test_dir_1")
10
10
  CliTree.new.parse_args(args)
11
11
  end
12
- captured.out.should match /d3.layout.partition/
12
+ expect(captured.out).to match /d3.layout.partition/
13
13
  end
14
14
 
15
15
  it 'should accepts --format html_tree' do
@@ -18,7 +18,7 @@ describe CliTree do
18
18
  args << File.join(FIXTURES, "test_dir_1")
19
19
  CliTree.new.parse_args(args)
20
20
  end
21
- captured.out.should match /d3.layout.tree/
21
+ expect(captured.out).to match /d3.layout.tree/
22
22
  end
23
23
 
24
24
  it 'should accepts --format html_treemap' do
@@ -27,6 +27,6 @@ describe CliTree do
27
27
  args << File.join(FIXTURES, "test_dir_1")
28
28
  CliTree.new.parse_args(args)
29
29
  end
30
- captured.out.should match /d3.layout.treemap/
30
+ expect(captured.out).to match /d3.layout.treemap/
31
31
  end
32
32
  end
@@ -15,7 +15,7 @@ a4788ba25d42f21003db11ec53112f1e file.1.1
15
15
  afb96f2652f4ba3cd84f7be0ae6fffe3 file.1.2.1
16
16
  c4c0c530b842efe4038ac4a659bfbe77 file.2.1
17
17
  EOS
18
- captured.out.should == certified_out
18
+ expect(captured.out).to be == certified_out
19
19
  end
20
20
 
21
21
  it "should accepts --sha1sum switch" do
@@ -30,7 +30,7 @@ EOS
30
30
  4b7f45a8c0be069e7eac5f7d64b997c92c740656 file.1.2.1
31
31
  3c58aeb1552b0318a86279b52c918f2fb953b4b9 file.2.1
32
32
  EOS
33
- captured.out.should == certified_out
33
+ expect(captured.out).to be == certified_out
34
34
  end
35
35
 
36
36
  end
@@ -8,7 +8,7 @@ describe CliTree do
8
8
  args = %w{--help}
9
9
  CliTree.new.parse_args(args)
10
10
  end
11
- captured.out.should match /Usage:/
11
+ expect(captured.out).to match(/Usage:/)
12
12
  end
13
13
 
14
14
  it "should accept --version switch" do
@@ -17,7 +17,7 @@ describe CliTree do
17
17
  CliTree.new.parse_args(args)
18
18
  end
19
19
  version = TreeRb::VERSION
20
- captured.out.should match version
20
+ expect(captured.out).to match(version)
21
21
  end
22
22
 
23
23
  it "should accepts -d switch (directories only)" do
@@ -27,8 +27,8 @@ describe CliTree do
27
27
  CliTree.new.parse_args(args)
28
28
  end
29
29
  expected = "test_dir_1\n|-- dir.1\n| `-- dir.1.2\n`-- dir.2\n\n4 directories, 0 files\n"
30
- captured.out.should == expected
31
- captured.out.split("\n").length.should == 6
30
+ expect(captured.out).to be == expected
31
+ expect(captured.out.split("\n").length).to be == 6
32
32
  end
33
33
 
34
34
  it "should accepts -da switch (directories only)" do
@@ -38,8 +38,8 @@ describe CliTree do
38
38
  CliTree.new.parse_args(args)
39
39
  end
40
40
  expected = "test_dir_1\n|-- .dir_with_dot\n|-- dir.1\n| `-- dir.1.2\n`-- dir.2\n\n5 directories, 0 files\n"
41
- captured.out.should == expected
42
- captured.out.split("\n").length.should == 7
41
+ expect(captured.out).to be == expected
42
+ expect(captured.out.split("\n").length).to be == 7
43
43
  end
44
44
 
45
45
  it "should accepts -a switch (all files)" do
@@ -50,8 +50,8 @@ describe CliTree do
50
50
  end
51
51
  # pp captured
52
52
  expected ="test_dir_1\n|-- .dir_with_dot\n| `-- dummy.txt\n|-- dir.1\n| |-- file.1.1\n| `-- dir.1.2\n| `-- file.1.2.1\n`-- dir.2\n `-- file.2.1\n\n5 directories, 4 files\n"
53
- captured.out.should == expected
54
- captured.out.split("\n").length.should == 11
53
+ expect(captured.out).to be == expected
54
+ expect(captured.out.split("\n").length).to be == 11
55
55
  end
56
56
 
57
57
  it "should accepts -a switch (all files)" do
@@ -62,8 +62,8 @@ describe CliTree do
62
62
  end
63
63
  # puts captured
64
64
  expected ="test_dir_1\n|-- dir.1\n| |-- file.1.1\n| `-- dir.1.2\n| `-- file.1.2.1\n`-- dir.2\n `-- file.2.1\n\n4 directories, 3 files\n"
65
- captured.out.should == expected
66
- captured.out.split("\n").length.should == 9
65
+ expect(captured.out).to be == expected
66
+ expect(captured.out.split("\n").length).to be == 9
67
67
  end
68
68
 
69
69
  it "should accepts -A switch (ascii line graphics)" do
@@ -84,7 +84,7 @@ test_dir_1
84
84
 
85
85
  4 directories, 3 files
86
86
  EOS
87
- captured.out.encode('utf-8').should == expected.encode('utf-8')
87
+ expect(captured.out.encode('utf-8')).to be == expected.encode('utf-8')
88
88
  end
89
89
 
90
90
  it "should show tree with inaccessible directories" do
@@ -115,10 +115,10 @@ test_dir_3_with_error
115
115
  EOS
116
116
  expected_err=/Permission denied/
117
117
 
118
- captured.out.should == expected_out
119
- captured.err.should match expected_err
120
- captured.err.should_not be_empty
121
- captured.out.split("\n").length.should == 4
118
+ expect(captured.out).to be == expected_out
119
+ expect(captured.err).to match(expected_err)
120
+ expect(captured.err).not_to be_empty
121
+ expect(captured.out.split("\n").length).to be == 4
122
122
 
123
123
  # File.chmod(0644,d)
124
124
  # Dir.unlink(d)