Sha256: e334f651798c2171a242bdf36991647aa09dedd5b8dbea4c5c168689dcb80d1f

Contents?: true

Size: 1.15 KB

Versions: 17

Compression:

Stored size: 1.15 KB

Contents

require_relative '../../spec_helper'

# Load the class under test
require_relative '../../../lib/rley/syntax/non_terminal'

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

      context 'Initialization:' do
        it 'should be created with a name' do
          expect { NonTerminal.new('noun') }.not_to raise_error
        end

        it 'should know its name' do
          expect(subject.name).to eq(sample_name)
        end
        
        it 'should know that is a not a terminal' do
          expect(subject).not_to be_terminal
        end
      end # context

        
      context 'Provided services:' do    
        it 'should know whether it is nullable' do
          expect(subject.nullable?).to be_nil
          subject.nullable = true
          expect(subject).to be_nullable
          subject.nullable = false
          expect(subject).not_to be_nullable          
        end
      end # context
    end # describe
  end # module
end # module

# End of file

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
rley-0.4.05 spec/rley/syntax/non_terminal_spec.rb
rley-0.4.04 spec/rley/syntax/non_terminal_spec.rb
rley-0.4.03 spec/rley/syntax/non_terminal_spec.rb
rley-0.4.02 spec/rley/syntax/non_terminal_spec.rb
rley-0.4.01 spec/rley/syntax/non_terminal_spec.rb
rley-0.4.00 spec/rley/syntax/non_terminal_spec.rb
rley-0.3.12 spec/rley/syntax/non_terminal_spec.rb
rley-0.3.11 spec/rley/syntax/non_terminal_spec.rb
rley-0.3.10 spec/rley/syntax/non_terminal_spec.rb
rley-0.3.09 spec/rley/syntax/non_terminal_spec.rb
rley-0.3.08 spec/rley/syntax/non_terminal_spec.rb
rley-0.3.07 spec/rley/syntax/non_terminal_spec.rb
rley-0.3.06 spec/rley/syntax/non_terminal_spec.rb
rley-0.3.05 spec/rley/syntax/non_terminal_spec.rb
rley-0.3.04 spec/rley/syntax/non_terminal_spec.rb
rley-0.3.01 spec/rley/syntax/non_terminal_spec.rb
rley-0.3.00 spec/rley/syntax/non_terminal_spec.rb