Sha256: 5652410bbbda894051c1cc237b93dd5b59825b4d4f8fefbca7a9ae5ef20dba8c

Contents?: true

Size: 775 Bytes

Versions: 2

Compression:

Stored size: 775 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
        Parser.parse("{\"some\": \"JSON\"}")
          .must_be_instance_of(Composition)
      end

      it 'returns a Composition when the output is a Hash' do
        Parser.parse({
          parser_parse: 'Parser#parse'
        }).must_be_instance_of(Composition)
      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

2 entries across 2 versions & 1 rubygems

Version Path
vedeu-0.0.33 test/lib/vedeu/support/parser_test.rb
vedeu-0.0.32 test/lib/vedeu/support/parser_test.rb