Sha256: bb719d7bea633c4c2cde05c96a5a68cd724032fb0463988842e98e38125154a0

Contents?: true

Size: 1.12 KB

Versions: 11

Compression:

Stored size: 1.12 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/end_vertex'

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

      context 'Initialization:' do
        it 'should be created with a non-terminal symbol' do
          expect { EndVertex.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::EndVertex:\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/end_vertex_spec.rb
rley-0.8.10 spec/rley/gfg/end_vertex_spec.rb
rley-0.8.09 spec/rley/gfg/end_vertex_spec.rb
rley-0.8.08 spec/rley/gfg/end_vertex_spec.rb
rley-0.8.06 spec/rley/gfg/end_vertex_spec.rb
rley-0.8.05 spec/rley/gfg/end_vertex_spec.rb
rley-0.8.03 spec/rley/gfg/end_vertex_spec.rb
rley-0.8.02 spec/rley/gfg/end_vertex_spec.rb
rley-0.8.01 spec/rley/gfg/end_vertex_spec.rb
rley-0.8.00 spec/rley/gfg/end_vertex_spec.rb
rley-0.7.08 spec/rley/gfg/end_vertex_spec.rb