Class: MarkdownExec::TestHashDelegator::TestHashDelegatorIterBlocksFromNestedFiles

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

Instance Method Summary collapse

Instance Method Details

#setupObject



2965
2966
2967
2968
2969
2970
2971
2972
2973
# File 'lib/hash_delegator.rb', line 2965

def setup
  @hd = HashDelegator.new
  @hd.instance_variable_set(:@delegate_object,
                            { filename: 'test.md' })
  @hd.stubs(:check_file_existence).with('test.md').returns(true)
  @hd.stubs(:initial_state).returns({})
  @hd.stubs(:cfile).returns(Minitest::Mock.new)
  @hd.stubs(:update_line_and_block_state)
end

#test_iter_blocks_from_nested_filesObject



2975
2976
2977
2978
2979
2980
2981
2982
2983
# File 'lib/hash_delegator.rb', line 2975

def test_iter_blocks_from_nested_files
  @hd.cfile.expect(:readlines, ['line 1', 'line 2'], ['test.md'], import_paths: nil)
  selected_messages = ['filtered message']

  result = @hd.iter_blocks_from_nested_files { selected_messages }
  assert_equal ['line 1', 'line 2'], result

  @hd.cfile.verify
end

#test_iter_blocks_from_nested_files_with_no_fileObject



2985
2986
2987
2988
2989
2990
2991
# File 'lib/hash_delegator.rb', line 2985

def test_iter_blocks_from_nested_files_with_no_file
  @hd.stubs(:check_file_existence).with('test.md').returns(false)

  assert_nil(@hd.iter_blocks_from_nested_files do
               ['filtered message']
             end)
end