Class: MarkdownExec::TestHashDelegatorCreateAndWriteFile

Inherits:
Minitest::Test
  • Object
show all
Defined in:
lib/hash_delegator.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



6464
6465
6466
6467
6468
6469
6470
# File 'lib/hash_delegator.rb', line 6464

def setup
  @hd = HashDelegator.new
  HashDelegator.stubs(:error_handler)
  FileUtils.stubs(:mkdir_p)
  File.stubs(:write)
  File.stubs(:chmod)
end

#test_create_and_write_file_without_chmodObject



6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
# File 'lib/hash_delegator.rb', line 6488

def test_create_and_write_file_without_chmod
  file_path = '/path/to/file'
  content = 'sample content'
  chmod_value = 0

  FileUtils.expects(:mkdir_p).with('/path/to').once
  File.expects(:write).with(file_path, content).once
  File.expects(:chmod).never

  HashDelegator.create_file_and_write_string_with_permissions(
    file_path, content, chmod_value
  )

  assert true # Placeholder for actual test assertions
end

#test_create_file_and_write_string_with_permissionsObject



6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
# File 'lib/hash_delegator.rb', line 6472

def test_create_file_and_write_string_with_permissions
  file_path = '/path/to/file'
  content = 'sample content'
  chmod_value = 0o644

  FileUtils.expects(:mkdir_p).with('/path/to').once
  File.expects(:write).with(file_path, content).once
  File.expects(:chmod).with(chmod_value, file_path).once

  HashDelegator.create_file_and_write_string_with_permissions(
    file_path, content, chmod_value
  )

  assert true # Placeholder for actual test assertions
end