Class: MarkdownExec::TestHashDelegator::TestHashDelegatorCreateAndWriteFile

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

Instance Method Summary collapse

Instance Method Details

#setupObject



2644
2645
2646
2647
2648
2649
2650
# File 'lib/hash_delegator.rb', line 2644

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



2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
# File 'lib/hash_delegator.rb', line 2667

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



2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
# File 'lib/hash_delegator.rb', line 2652

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