Sha256: ea8f01e317bdd228c3a7ca206ed899303fc080c5403f5888fcc4c5a12892c7fe

Contents?: true

Size: 582 Bytes

Versions: 2

Compression:

Stored size: 582 Bytes

Contents

require 'spec_helper'

describe Society::Matrix do

  let(:node)   { Struct.new(:name, :references)}
  let(:nodes)  {
    [
      node.new("foo", %w{bar bat baz}),
      node.new("bar", %w{foo bat baz})
    ]
  }
  let(:matrix) { Society::Matrix.new(nodes) }

  describe "#initialize" do
    it "assigns its nodes" do
      expect(matrix.nodes).to eq(nodes)
    end
  end

  describe "#to_json" do
    it "generates a json representation" do
      expected = "{\"names\":[\"foo\",\"bar\"],\"matrix\":[[],[0,1],[1,0]]}"
      expect(matrix.to_json).to eq(expected)
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
society-0.13.1 spec/matrix_spec.rb
society-0.13.0 spec/matrix_spec.rb