Class: MarkdownExec::TestHashDelegatorCountBlockInFilename
- Inherits:
-
Minitest::Test
- Object
- Minitest::Test
- MarkdownExec::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
6477 6478 6479 6480 6481 6482 6483 |
# File 'lib/hash_delegator.rb', line 6477 def setup @hd = HashDelegator.new( fenced_start_and_end_regex: '^```', filename: '/path/to/file' ) @hd.stubs(:cfile).returns(mock('cfile')) end |
#test_count_blocks_in_filename ⇒ Object
6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 |
# File 'lib/hash_delegator.rb', line 6485 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
6496 6497 6498 6499 6500 6501 6502 6503 6504 |
# File 'lib/hash_delegator.rb', line 6496 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 |