Sha256: ae8f6d2ff4c5d51e01566c4b25687452108ae6f5ff71eb2d3167bd35b9c33506

Contents?: true

Size: 1.12 KB

Versions: 9

Compression:

Stored size: 1.12 KB

Contents

require_relative '../../spec_helper'

# Load the class under test
require_relative '../../../lib/rley/ptree/non_terminal_node'

module Rley # Open this namespace to avoid module qualifier prefixes
  module PTree # Open this namespace to avoid module qualifier prefixes
    describe NonTerminalNode do
      let(:sample_symbol) { double('fake-symbol') }
      let(:sample_range) { double('fake-range') }
      
      subject { NonTerminalNode.new(sample_symbol, sample_range) }

      context 'Initialization:' do
        it "shouldn't have children yet" do
          expect(subject.children).to be_empty
        end
      end # context
      
      context 'Provided services:' do
        it 'should accept children' do
          child1 = double('first_child')
          child2 = double('second_child')
          child3 = double('third_child')
          expect { subject.add_child(child1) }.not_to raise_error
          subject.add_child(child2)
          subject.add_child(child3)
          expect(subject.children).to eq([child1, child2, child3])
        end
      end # context

    end # describe
  end # module
end # module

# End of file

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rley-0.1.08 spec/rley/ptree/non_terminal_node_spec.rb
rley-0.1.07 spec/rley/ptree/non_terminal_node_spec.rb
rley-0.1.06 spec/rley/ptree/non_terminal_node_spec.rb
rley-0.1.05 spec/rley/ptree/non_terminal_node_spec.rb
rley-0.1.04 spec/rley/ptree/non_terminal_node_spec.rb
rley-0.1.03 spec/rley/ptree/non_terminal_node_spec.rb
rley-0.1.02 spec/rley/ptree/non_terminal_node_spec.rb
rley-0.1.01 spec/rley/ptree/non_terminal_node_spec.rb
rley-0.1.00 spec/rley/ptree/non_terminal_node_spec.rb