Config-Resolver

 view release on metacpan or  search on metacpan

t/09_write_output.t  view on Meta::CPAN

  my $expected_json = to_json( $hash_data, { pretty => 0, allow_blessed => 1, convert_blessed => 1 } );

  # 2. Run the sub -- this will create the file
  $mock->write_output($hash_data);

  # 3. Test the file's *content*
  my $file_content = slurp_file($temp_file);
  is( $file_content, $expected_json, 'File content is correct' );

  # 4. Test the file's *permissions*
  # (stat($file))[2] returns the mode
  my $mode = ( stat($temp_file) )[2] & 0777;
  # A umask of 0077 on a file (default 0666) should be 0600
  my $expected_mode = 0600;  # (rw-------)

  is( $mode, $expected_mode, 'File permissions are correctly set by umask 0077' );
};

done_testing();

1;



( run in 0.680 second using v1.01-cache-2.11-cpan-dd325dfa429 )