Class: MarkdownExec::TestHashDelegatorCommandOrUserSelectedBlock
- Inherits:
-
Minitest::Test
- Object
- Minitest::Test
- MarkdownExec::TestHashDelegatorCommandOrUserSelectedBlock
- Defined in:
- lib/hash_delegator.rb
Instance Method Summary collapse
Instance Method Details
#setup ⇒ Object
4495 4496 4497 4498 4499 4500 |
# File 'lib/hash_delegator.rb', line 4495 def setup @hd = HashDelegator.new @hd.instance_variable_set(:@delegate_object, {}) HashDelegator.stubs(:error_handler) @hd.stubs(:wait_for_user_selected_block) end |
#test_command_selected_block ⇒ Object
4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 |
# File 'lib/hash_delegator.rb', line 4502 def test_command_selected_block all_blocks = [{ oname: 'block1' }, { oname: 'block2' }] @hd.instance_variable_set(:@delegate_object, { block_name: 'block1' }) result = @hd.load_cli_or_user_selected_block(all_blocks: all_blocks) assert_equal all_blocks.first, result.block assert_equal OpenStruct.new(block_name_from_ui: false), result.source assert_nil result.state end |
#test_user_selected_block ⇒ Object
4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 |
# File 'lib/hash_delegator.rb', line 4516 def test_user_selected_block block_state = SelectedBlockMenuState.new( { oname: 'block2' }, OpenStruct.new, :some_state ) @hd.stubs(:wait_for_user_selected_block).returns(block_state) result = @hd.load_cli_or_user_selected_block assert_equal block_state.block, result.block assert_equal OpenStruct.new(block_name_from_ui: true), result.source assert_equal :some_state, result.state end |