Class: MarkdownExec::TestHashDelegator::TestHashDelegatorCreateAndWriteFile

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

Instance Method Summary collapse

Instance Method Details

#setupObject



2798
2799
2800
2801
2802
2803
2804
# File 'lib/hash_delegator.rb', line 2798

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



2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
# File 'lib/hash_delegator.rb', line 2821

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



2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
# File 'lib/hash_delegator.rb', line 2806

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