Class: BlockLabelTest

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

Instance Method Summary collapse

Instance Method Details

#setupObject



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/block_label.rb', line 47

def setup
  @block_data = {
    filename: 'example.md',
    headings: %w[Header1 Header2],
    menu_blocks_with_docname: true,
    menu_blocks_with_headings: false,
    title: 'Sample Title',
    body: 'Sample Body',
    text: 'Sample Text'
  }
end

#test_make_methodObject



59
60
61
# File 'lib/block_label.rb', line 59

def test_make_method
  assert_equal 'Sample Title  example.md', BlockLabel.make(**@block_data)
end

#test_make_method_with_headingsObject



76
77
78
79
80
# File 'lib/block_label.rb', line 76

def test_make_method_with_headings
  @block_data[:menu_blocks_with_headings] = true
  label = BlockLabel.make(**@block_data)
  assert_equal 'Sample Title  Header1 # Header2  example.md', label
end

#test_make_method_without_titleObject



63
64
65
66
67
# File 'lib/block_label.rb', line 63

def test_make_method_without_title
  @block_data[:title] = nil
  label = BlockLabel.make(**@block_data)
  assert_equal 'Sample Body  example.md', label
end

#test_make_method_without_title_and_bodyObject



69
70
71
72
73
74
# File 'lib/block_label.rb', line 69

def test_make_method_without_title_and_body
  @block_data[:title] = nil
  @block_data[:body] = nil
  label = BlockLabel.make(**@block_data)
  assert_equal 'Sample Text  example.md', label
end