Sha256: 6a5d0df3899a94851f6eaccec8a3652e239f4526d63fa34135992236a34f0ac8

Contents?: true

Size: 922 Bytes

Versions: 3

Compression:

Stored size: 922 Bytes

Contents

require "spec_helper"

describe Graphshaper::LoggingAdapter do
  before :each do
    @vertex_logger = double()
    @vertex_logger.stub :<<
    @edge_logger = double()
    @edge_logger.stub :<<
  end
  
  it "should write a header into the files" do
    @vertex_logger.should_receive(:<<).with("vertex_id\n")
    @edge_logger.should_receive(:<<).with("edge_id,from_id,to_id\n")
    Graphshaper::LoggingAdapter.new @vertex_logger, @edge_logger
  end
  
  describe "Initialized Logger" do
    before :each do
      @adapter = Graphshaper::LoggingAdapter.new @vertex_logger, @edge_logger
    end
    
    it "should write edges to the logger at edge creation" do
      @edge_logger.should_receive(:<<).with("0,1,3\n")
      @adapter.add_edge 0,1,3
    end
    
    it "should write vertices to the logger at vertex creation" do
      @vertex_logger.should_receive(:<<).with("5\n")
      @adapter.add_vertex 5
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
graphshaper-0.2.2 spec/adapters/logging_adapter_spec.rb
graphshaper-0.2.1 spec/adapters/logging_adapter_spec.rb
graphshaper-0.2 spec/adapters/logging_adapter_spec.rb