Sha256: 92edff0c505db363d7a56aea095d37e0cfe1359c8f48072c6d04a0c433f08d8d

Contents?: true

Size: 1.82 KB

Versions: 1

Compression:

Stored size: 1.82 KB

Contents

require File.expand_path('../../../spec_helper', __FILE__)

include Fathom

describe Network do
  
  it "should initialize a name accessor" do
    Network.should have_an_initialization_accessor_for(:name)
  end
  
  it "should initialize a variables accessor" do
    Network.should have_an_initialization_accessor_for(:variables)
  end
  
  it "should default the variables to an array" do
    Network.new.variables.should eql([])
  end
  
  it "should extend Enumerable" do
    Network.ancestors.should be_include(Enumerable)
  end
  
  it "should enumerate over the variables" do
    n = Network.new :variables => [1,2,3]
    n.map.to_a.should eql([1,2,3])
  end

  it "should initialize a properties accessor" do
    Network.should have_an_initialization_accessor_for(:properties)
  end
  
  it "should default the properties to an Array" do
    Network.new.properties.should eql([])
  end

  it "should initialize an edges accessor" do
    Network.should have_an_initialization_accessor_for(:edges)
  end
  
  it "should default the edges to an Array" do
    Network.new.edges.should eql([])
  end
  
  it "should initialize a definitions accessor" do
    Network.should have_an_initialization_accessor_for(:definitions)
  end
  
  it "should default the definitions to an Array" do
    Network.new.definitions.should eql([])
  end
  
  context "when using the Enumerator" do
    before do
      @n = Network.new :variables => [1,2,3]
      @variables = @n.variables 
    end
    
    it "should be able to iterate on the variables" do
      @n.each {|v| @variables.should be_include(v)}
    end
  
    it "should have each_variable as an alias to each" do
      @n.each_variable {|v| @variables.should be_include(v)}
    end
  
    it "should use the variable enumeration for the Enumerable" do
      @n.map {|v| v }.should eql([1,2,3])
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fathom-0.5.0 spec/fathom/data/network_spec.rb