Module: Treebis::Test::TestRemove

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

Instance Method Summary collapse

Instance Method Details

#test_remove_not_prettyObject



1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
# File 'lib/treebis.rb', line 1365

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



1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
# File 'lib/treebis.rb', line 1351

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