Sha256: a47a027d1d2aee2eb5c8e9462fd9189eeaec6527edd2e58593355d921a65d2f6
Contents?: true
Size: 1.45 KB
Versions: 46
Compression:
Stored size: 1.45 KB
Contents
require_relative '../../spec_helper' require_relative '../../../lib/rley/syntax/non_terminal' # Load the class under test require_relative '../../../lib/rley/gfg/shortcut_edge' module Rley # Open this namespace to avoid module qualifier prefixes module GFG # Open this namespace to avoid module qualifier prefixes describe Edge do let(:nt_b_sequence) { Rley::Syntax::NonTerminal.new('b_sequence') } let(:vertex1) { double('fake_vertex1') } let(:vertex2) { double('fake_vertex2') } subject { ShortcutEdge.new(vertex1, vertex2) } context 'Initialization:' do it 'should be created with two vertice arguments & a non-terminal' do expect(vertex1).to receive(:shortcut=) expect(vertex1).to receive(:next_symbol).and_return(nt_b_sequence) expect { ShortcutEdge.new(vertex1, vertex2) } .not_to raise_error end it 'should know the successor vertex' do expect(vertex1).to receive(:shortcut=) expect(vertex1).to receive(:next_symbol).and_return(nt_b_sequence) expect(subject.successor).to eq(vertex2) end it 'should know the related terminal' do expect(vertex1).to receive(:shortcut=) expect(vertex1).to receive(:next_symbol).and_return(nt_b_sequence) expect(subject.nonterminal).to eq(nt_b_sequence) end end # context end # describe end # module end # module # End of file
Version data entries
46 entries across 46 versions & 1 rubygems