Class: MarkdownExec::TestHashDelegator::TestHashDelegatorFetchColor

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

Instance Method Summary collapse

Instance Method Details

#setupObject



2894
2895
2896
2897
# File 'lib/hash_delegator.rb', line 2894

def setup
  @hd = HashDelegator.new
  @hd.instance_variable_set(:@delegate_object, {})
end

#test_fetch_color_with_missing_dataObject



2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
# File 'lib/hash_delegator.rb', line 2911

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



2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
# File 'lib/hash_delegator.rb', line 2899

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