Sha256: 53e337d07f55bdc19f796d5e28fdb064039cd5be3b514671afd1883c4b57da69

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

require_relative '../../spec_helper'

require_relative '../../../lib/rley/gfg/start_vertex'
require_relative '../../../lib/rley/gfg/end_vertex'

# Load the class under test
require_relative '../../../lib/rley/gfg/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(:vertex1) { StartVertex.new('from') }
      let(:vertex2) { StartVertex.new('to') }
      subject { Edge.new(vertex1, vertex2) }

      context 'Initialization:' do
        it 'should be created with two vertice arguments' do
          expect { Edge.new(vertex1, vertex2) }.not_to raise_error
        end
        
        it 'should be registered by the predecessor vertex' do
          expect(subject).to eq(vertex1.edges.last)
        end
        
        it 'should know the successor vertex' do
          expect(subject.successor).to eq(vertex2)
        end
      end # context
    end # describe
  end # module
end # module

# End of file

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rley-0.3.04 spec/rley/gfg/edge_spec.rb
rley-0.3.01 spec/rley/gfg/edge_spec.rb
rley-0.3.00 spec/rley/gfg/edge_spec.rb
rley-0.2.15 spec/rley/gfg/edge_spec.rb