Sha256: a7e646e9c753e205cf9e0b4773818bde4d2952de45e5d5db37a2bdd7b46055bf
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
require "spec_helper" require "graphshaper/adapters/dot_adapter.rb" describe Graphshaper::DotAdapter do before :each do @output_file = double() @output_file.stub :<< end it "should write a header into the file" do @output_file.should_receive(:<<).with("digraph genereated_graph { \n rankdir=LR;\n node [shape = circle];\n edge [dir=none];\n") Graphshaper::DotAdapter.new @output_file end describe "initialized Dot Adapter" do before :each do @dot_adapter = Graphshaper::DotAdapter.new @output_file end it "should be closeable" do @output_file.should_receive(:<<).with("}") @output_file.should_receive(:close) @dot_adapter.close end it "should write an edge in the correct format" do @output_file.should_receive(:<<).with(" 1 -> 2 [ label = \"0\" ];\n") @dot_adapter.add_edge(0,1,2) end it "should write a vertex in the correct format" do @output_file.should_receive(:<<).with(" 15;\n") @dot_adapter.add_vertex(15) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
graphshaper-0.2.4 | spec/adapters/dot_adapter_spec.rb |
graphshaper-0.2.3 | spec/adapters/dot_adapter_spec.rb |