Class: MarkdownExec::TestHashDelegator::TestHashDelegatorFetchColor

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

Instance Method Summary collapse

Instance Method Details

#setupObject



2952
2953
2954
2955
# File 'lib/hash_delegator.rb', line 2952

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

#test_fetch_color_with_missing_dataObject



2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
# File 'lib/hash_delegator.rb', line 2969

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



2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
# File 'lib/hash_delegator.rb', line 2957

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