Class: MarkdownExec::TestHashDelegatorCreateAndWriteFile

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

Instance Method Summary collapse

Instance Method Details

#setupObject



6643
6644
6645
6646
6647
6648
6649
# File 'lib/hash_delegator.rb', line 6643

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



6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
# File 'lib/hash_delegator.rb', line 6667

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



6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
# File 'lib/hash_delegator.rb', line 6651

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