Class: MarkdownExec::TestHashDelegator::TestHashDelegatorCountBlockInFilename
- Inherits:
-
Minitest::Test
- Object
- Minitest::Test
- MarkdownExec::TestHashDelegator::TestHashDelegatorCountBlockInFilename
- Defined in:
- lib/hash_delegator.rb
Instance Method Summary collapse
- #setup ⇒ Object
- #test_count_blocks_in_filename ⇒ Object
- #test_count_blocks_in_filename_with_no_matches ⇒ Object
Instance Method Details
#setup ⇒ Object
2711 2712 2713 2714 2715 2716 2717 |
# File 'lib/hash_delegator.rb', line 2711 def setup @hd = HashDelegator.new @hd.instance_variable_set(:@delegate_object, { fenced_start_and_end_regex: '^```', filename: '/path/to/file' }) @hd.stubs(:cfile).returns(mock('cfile')) end |
#test_count_blocks_in_filename ⇒ Object
2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 |
# File 'lib/hash_delegator.rb', line 2719 def test_count_blocks_in_filename file_content = ["```ruby\n", "puts 'Hello'\n", "```\n", "```python\n", "print('Hello')\n", "```\n"] @hd.cfile.stubs(:readlines).with('/path/to/file', import_paths: nil).returns(file_content) count = @hd.count_blocks_in_filename assert_equal 2, count end |
#test_count_blocks_in_filename_with_no_matches ⇒ Object
2730 2731 2732 2733 2734 2735 2736 2737 2738 |
# File 'lib/hash_delegator.rb', line 2730 def test_count_blocks_in_filename_with_no_matches file_content = ["puts 'Hello'\n", "print('Hello')\n"] @hd.cfile.stubs(:readlines).with('/path/to/file', import_paths: nil).returns(file_content) count = @hd.count_blocks_in_filename assert_equal 0, count end |