Class: MarkdownExec::TestHashDelegator::TestHashDelegatorFetchColor

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

Instance Method Summary collapse

Instance Method Details

#setupObject



2740
2741
2742
2743
# File 'lib/hash_delegator.rb', line 2740

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

#test_fetch_color_with_missing_dataObject



2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
# File 'lib/hash_delegator.rb', line 2757

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



2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
# File 'lib/hash_delegator.rb', line 2745

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