Sha256: 45e8eec62f1b99cee0ec8965decc2f8183f353cb75059800a7bc48b74f647924

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

require_relative '../../../../test_helper'
require_relative '../../../../../lib/vedeu/support/parsing/hash_parser'

module Vedeu
  describe HashParser do
    let(:described_module) { HashParser }
    let(:output)           { {} }

    describe '.parse' do
      let(:subject) { described_module.parse(output) }
      let(:lines)   { mock }

      before { TextAdaptor.stubs(:adapt).returns(lines) }

      it 'returns a Hash' do
        subject.must_be_instance_of(Hash)
      end

      context 'when the output is content for a collection of interfaces' do
        let(:output) {
          {
            test: 'Some content...',
            dummy: 'More content...'
          }
        }

        it 'returns a Hash' do
          subject.must_equal({ interfaces: [{ name: 'test', lines: lines }, { name: 'dummy', lines: lines }] })
        end
      end

      context 'when the output is content for a single interface' do
        let(:output) {
          {
            dummy: 'Some content...'
          }
        }

        it 'returns a Hash' do
          subject.must_equal({ interfaces: [{ name: 'dummy', lines: lines }] })
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vedeu-0.0.30 test/lib/vedeu/support/parsing/hash_parser_test.rb
vedeu-0.0.29 test/lib/vedeu/support/parsing/hash_parser_test.rb
vedeu-0.0.28 test/lib/vedeu/support/parsing/hash_parser_test.rb