Sha256: 688937e830c003568d4ed5b69c6162a7da6cdb961266a4c35e1d2ad773269905

Contents?: true

Size: 876 Bytes

Versions: 3

Compression:

Stored size: 876 Bytes

Contents

require_relative '../../../test_helper'
require_relative '../../../../lib/vedeu/support/parser'

module Vedeu
  describe Parser do
    describe '#parse' do
      it 'returns a NilClass when the output is empty' do
        Parser.parse.must_be_instance_of(NilClass)
      end

      it 'returns a Composition when the output is JSON' do
        skip('This is not working as it should...')

        Parser.parse("{\"some\": \"JSON\"}")
          .must_be_instance_of(Composition)
      end

      it 'returns a collection of interfaces when the output is a Hash' do
        parser = Parser.parse({ parser_parse: 'Parser#parse' })

        parser.must_be_instance_of(Array)
        parser.size.must_equal(1)
      end

      it 'raises an exception when the output is anything else' do
        proc { Parser.parse([:invalid]) }.must_raise(ParseError)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vedeu-0.0.36 test/lib/vedeu/support/parser_test.rb
vedeu-0.0.35 test/lib/vedeu/support/parser_test.rb
vedeu-0.0.34 test/lib/vedeu/support/parser_test.rb