X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;ds=sidebyside;f=spec%2Ferd_handler%2Ferd_spec.rb;h=164a91eb3f170e8bd9c0948584df9f8d3b7231b1;hb=4f2c2f6f7795c9337796c16beb8126dfc42a940c;hp=ec75afeb416448d92dd0f0fba9f584384592ee0a;hpb=29a64f0a2207a69d136c6f67edcd6855af8152d8;p=erd-marker.git diff --git a/spec/erd_handler/erd_spec.rb b/spec/erd_handler/erd_spec.rb index ec75afe..164a91e 100644 --- a/spec/erd_handler/erd_spec.rb +++ b/spec/erd_handler/erd_spec.rb @@ -1,19 +1,34 @@ require 'spec_helper' -module Erd +module ErdHandler describe Erd do let(:input) { double('input').as_null_object } let(:output) { double('output').as_null_object } let(:erd) { Erd.new(input, output) } - describe "#read" do - it "reads a single box" do - doc = Document.new File.new("spec/fixtures/single_box_erd.xml") - erd = Erd.new doc - erd.mark.should == 6.5 - erd.boxes.length.should == 1 - + describe "#initialize" do + it "creates an empty ERD" do + erd = Erd.new + erd.mark.should be_nil + erd.should have(0).vertices + erd.should have(0).edges end - end # #read + + it "reads and creates a single box" do + erd = Erd.new(File.new("spec/fixtures/single_box_erd.xml")) + erd.mark.should == 6.5 + erd.should have(1).vertices + erd.should have(0).edges + end + + it "reads and creates two boxes with an edge joining them" do + erd = Erd.new(File.new("spec/fixtures/two_boxes_one_link_erd.xml")) + erd.mark.should == 4.5 + erd.should have(2).vertices + erd.should have(1).edges + end + + it "reads and creates a box with a self-loop" + end # #initialize end end \ No newline at end of file