Class: FCBTest

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

Instance Method Summary collapse

Instance Method Details

#setupObject



532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
# File 'lib/fcb.rb', line 532

def setup
  @fcb_data = {
    block: nil,
    body: 'Sample body',
    call: 'Sample call',
    dname: 'Sample name',
    headings: %w[Header1 Header2],
    indent: '',
    name: 'Sample name',
    nickname: nil,
    oname: 'Sample name',
    reqs: %w[req1 req2],
    shell: ShellType::BASH,
    start_line: nil,
    text: 'Sample Text',
    title: 'Sample Title',
    type: 'shell'
  }
  @fcb = MarkdownExec::FCB.new(@fcb_data)
end

#test_initialization_with_correct_dataObject



553
554
555
556
# File 'lib/fcb.rb', line 553

def test_initialization_with_correct_data
  assert_equal 'Sample body', @fcb.body
  assert_equal %w[Header1 Header2], @fcb.headings
end

#test_method_missing_getterObject



570
571
572
# File 'lib/fcb.rb', line 570

def test_method_missing_getter
  assert_equal 'Sample Title', @fcb.title
end

#test_method_missing_setterObject



574
575
576
577
# File 'lib/fcb.rb', line 574

def test_method_missing_setter
  @fcb.title = 'New Title'
  assert_equal 'New Title', @fcb.title
end

#test_to_h_methodObject



558
559
560
561
562
# File 'lib/fcb.rb', line 558

def test_to_h_method
  assert_equal_hash @fcb_data.merge(
    { id: @fcb.id, random: @fcb.random }
  ), @fcb.to_h
end

#test_to_yaml_methodObject



564
565
566
567
568
# File 'lib/fcb.rb', line 564

def test_to_yaml_method
  assert_equal_hash YAML.load(@fcb_data.merge(
    { id: @fcb.id, random: @fcb.random }
  ).to_yaml), YAML.load(@fcb.to_yaml)
end