Class: MarkdownExec::TestHashDelegatorFetchColor

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

Instance Method Summary collapse

Instance Method Details

#setupObject



6744
6745
6746
# File 'lib/hash_delegator.rb', line 6744

def setup
  @hd = HashDelegator.new
end

#test_fetch_color_with_missing_dataObject



6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
# File 'lib/hash_delegator.rb', line 6761

def test_fetch_color_with_missing_data
  @hd.instance_variable_get(:@delegate_object).stubs(:fetch).with(
    :execution_report_preview_head, ''
  ).returns('')
  @hd.stubs(:string_send_color)
     .with('', :execution_report_preview_frame_color)
     .returns('Default Colored String')

  result = @hd.fetch_color

  assert_equal 'Default Colored String', result
end

#test_fetch_color_with_valid_dataObject



6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
# File 'lib/hash_delegator.rb', line 6748

def test_fetch_color_with_valid_data
  @hd.instance_variable_get(:@delegate_object).stubs(:fetch).with(
    :execution_report_preview_head, ''
  ).returns('Data String')
  @hd.stubs(:string_send_color)
     .with('Data String', :execution_report_preview_frame_color)
     .returns('Colored Data String')

  result = @hd.fetch_color

  assert_equal 'Colored Data String', result
end