Sha256: 7bea7d2c59a582e0bcc6f821dfbd5a3f9e314fbec78bd5e2d545a1301368211e

Contents?: true

Size: 870 Bytes

Versions: 3

Compression:

Stored size: 870 Bytes

Contents

require 'test_helper'
require 'vedeu/parsing/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
        file   = File.read('test/support/json/int1_lin1_str1.json')
        parser = Parser.parse(file)

        parser.must_be_instance_of(Array)
        parser.size.must_equal(1)
      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.1.0 test/lib/vedeu/parsing/parser_test.rb
vedeu-0.0.42 test/lib/vedeu/parsing/parser_test.rb
vedeu-0.0.41 test/lib/vedeu/parsing/parser_test.rb