Class: FCBTest

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

Instance Method Summary collapse

Instance Method Details

#setupObject



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/fcb.rb', line 111

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

#test_initialization_with_correct_dataObject



129
130
131
132
# File 'lib/fcb.rb', line 129

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

#test_method_missing_getterObject



143
144
145
# File 'lib/fcb.rb', line 143

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

#test_method_missing_setterObject



147
148
149
150
# File 'lib/fcb.rb', line 147

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

#test_to_h_methodObject



134
135
136
# File 'lib/fcb.rb', line 134

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

#test_to_yaml_methodObject



138
139
140
141
# File 'lib/fcb.rb', line 138

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