Sha256: 48ee5877f02684c337f603749a669aa2b6926b0e8f14afc5b25bafa1bd00b266

Contents?: true

Size: 580 Bytes

Versions: 2

Compression:

Stored size: 580 Bytes

Contents

require 'aquanaut'
require 'spec_helper'

describe Aquanaut::Node do

  describe "#initialize" do
    it "initializes an empty adjacency list" do
      node = Aquanaut::Node.new
      expect(node.adjacency_list).to be_empty
    end
  end

  describe "#add_edge" do
    it "adds a successor to the adjacency list" do
      node = Aquanaut::Node.new
      adjacent_node = Aquanaut::Node.new

      expect do
        node.add_edge(adjacent_node)
      end.to change { node.adjacency_list.count }.by(1)

      expect(node.adjacency_list.first).to eq(adjacent_node)
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aquanaut-0.1.2 spec/aquanaut/node_spec.rb
aquanaut-0.1.1 spec/aquanaut/node_spec.rb