Class: MarkdownExec::TestHashDelegator::TestHashDelegatorFetchColor

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

Instance Method Summary collapse

Instance Method Details

#setupObject



2838
2839
2840
2841
# File 'lib/hash_delegator.rb', line 2838

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

#test_fetch_color_with_missing_dataObject



2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
# File 'lib/hash_delegator.rb', line 2855

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



2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
# File 'lib/hash_delegator.rb', line 2843

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