Class: MarkdownExec::TestHashDelegatorFetchColor

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

Instance Method Summary collapse

Instance Method Details

#setupObject



4666
4667
4668
4669
# File 'lib/hash_delegator.rb', line 4666

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

#test_fetch_color_with_missing_dataObject



4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
# File 'lib/hash_delegator.rb', line 4684

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



4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
# File 'lib/hash_delegator.rb', line 4671

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