Class: FCBTest

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

Instance Method Summary collapse

Instance Method Details

#setupObject



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/fcb.rb', line 202

def setup
  @fcb_data = {
    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



222
223
224
225
# File 'lib/fcb.rb', line 222

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

#test_method_missing_getterObject



237
238
239
# File 'lib/fcb.rb', line 237

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

#test_method_missing_setterObject



241
242
243
244
# File 'lib/fcb.rb', line 241

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

#test_to_h_methodObject



227
228
229
# File 'lib/fcb.rb', line 227

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

#test_to_yaml_methodObject



231
232
233
234
235
# File 'lib/fcb.rb', line 231

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