Sha256: 5382bdb986317e93ea5d78acfb2be91f68dd4975da1fdab5c7b2a618950ec32b

Contents?: true

Size: 1.13 KB

Versions: 11

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

require_relative '../../spec_helper'
require_relative '../../../lib/rley/syntax/non_terminal'

# Load the class under test
require_relative '../../../lib/rley/gfg/start_vertex'

module Rley # Open this namespace to avoid module qualifier prefixes
  module GFG # Open this namespace to avoid module qualifier prefixes
    describe StartVertex do
      let(:sample_nt) { Syntax::NonTerminal.new('NT') }
      subject { StartVertex.new(sample_nt) }

      context 'Initialization:' do
        it 'should be created with a non-terminal symbol' do
          expect { StartVertex.new(sample_nt) }.not_to raise_error
        end

        it 'should know its label' do
          expect(sample_nt).to receive(:to_s).and_return('NT')
          expect(subject.label).to eq('.NT')
        end
      end # context

      context 'Provided services:' do
        it 'should provide human-readable representation of itself' do
          pattern = /^#<Rley::GFG::StartVertex:\d+ label="\.NT"/
          expect(subject.inspect).to match(pattern)
        end
      end # context
    end # describe
  end # module
end # module

# End of file

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rley-0.8.11 spec/rley/gfg/start_vertex_spec.rb
rley-0.8.10 spec/rley/gfg/start_vertex_spec.rb
rley-0.8.09 spec/rley/gfg/start_vertex_spec.rb
rley-0.8.08 spec/rley/gfg/start_vertex_spec.rb
rley-0.8.06 spec/rley/gfg/start_vertex_spec.rb
rley-0.8.05 spec/rley/gfg/start_vertex_spec.rb
rley-0.8.03 spec/rley/gfg/start_vertex_spec.rb
rley-0.8.02 spec/rley/gfg/start_vertex_spec.rb
rley-0.8.01 spec/rley/gfg/start_vertex_spec.rb
rley-0.8.00 spec/rley/gfg/start_vertex_spec.rb
rley-0.7.08 spec/rley/gfg/start_vertex_spec.rb