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
2825 2826 2827 2828 2829 2830 2831 |
# File 'lib/hash_delegator.rb', line 2825 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
2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 |
# File 'lib/hash_delegator.rb', line 2833 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
2844 2845 2846 2847 2848 2849 2850 2851 2852 |
# File 'lib/hash_delegator.rb', line 2844 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 |