Module: Treebis::Test::TestRemove

Included in:
TestCase
Defined in:
lib/treebis.rb

Instance Method Summary collapse

Instance Method Details

#test_remove_not_prettyObject



1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
# File 'lib/treebis.rb', line 1351

def test_remove_not_pretty
  task.new {
    write "foo.txt", "bar baz"
  }.on(tgt = empty_tmpdir("foo")).run

  assert_equal({"foo.txt"=>"bar baz"}, dir_as_hash(tgt))

  bb, cc, aa = capture3{
    tt = task.new do
      file_utils.not_pretty!
      remove "foo.txt"
    end
    tt.on(tgt).run
  }
  assert_match(/\Arm /, cc)
  assert aa.kind_of?(Array)
  assert_equal 1, aa.size
  assert_equal "", bb
  assert_equal({}, dir_as_hash(tgt))
end

#test_remove_prettyObject



1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
# File 'lib/treebis.rb', line 1337

def test_remove_pretty
  task.new {
    write "foo.txt", "bar baz"
  }.on(tgt = empty_tmpdir("foo")).run

  assert_equal({"foo.txt"=>"bar baz"}, dir_as_hash(tgt))

  task.new {
    remove "foo.txt"
  }.on(tgt).run

  assert_equal({}, dir_as_hash(tgt))
end