Class: MarkdownExec::TestHashDelegator::TestHashDelegatorCreateAndWriteFile

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

Instance Method Summary collapse

Instance Method Details

#setupObject



2742
2743
2744
2745
2746
2747
2748
# File 'lib/hash_delegator.rb', line 2742

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



2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
# File 'lib/hash_delegator.rb', line 2765

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



2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
# File 'lib/hash_delegator.rb', line 2750

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