Added test for ERD subclassing notation
authorNeil Smith <neil.github@njae.me.uk>
Fri, 29 Jun 2012 15:07:52 +0000 (16:07 +0100)
committerNeil Smith <neil.github@njae.me.uk>
Fri, 29 Jun 2012 15:07:52 +0000 (16:07 +0100)
bundler_stubs/autospec [new file with mode: 0755]
bundler_stubs/htmldiff [new file with mode: 0755]
bundler_stubs/ldiff [new file with mode: 0755]
bundler_stubs/rake [new file with mode: 0755]
bundler_stubs/ri [new file with mode: 0755]
bundler_stubs/rspec [new file with mode: 0755]
spec/erd_handler/erd_spec.rb
spec/fixtures/two_boxes_one_contained_erd.xml [new file with mode: 0644]

diff --git a/bundler_stubs/autospec b/bundler_stubs/autospec
new file mode 100755 (executable)
index 0000000..64dcb9c
--- /dev/null
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'autospec' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+  Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('rspec-core', 'autospec')
diff --git a/bundler_stubs/htmldiff b/bundler_stubs/htmldiff
new file mode 100755 (executable)
index 0000000..c70e238
--- /dev/null
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'htmldiff' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+  Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('diff-lcs', 'htmldiff')
diff --git a/bundler_stubs/ldiff b/bundler_stubs/ldiff
new file mode 100755 (executable)
index 0000000..8e3524a
--- /dev/null
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'ldiff' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+  Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('diff-lcs', 'ldiff')
diff --git a/bundler_stubs/rake b/bundler_stubs/rake
new file mode 100755 (executable)
index 0000000..26c7a2d
--- /dev/null
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'rake' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+  Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('rake', 'rake')
diff --git a/bundler_stubs/ri b/bundler_stubs/ri
new file mode 100755 (executable)
index 0000000..90f2517
--- /dev/null
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'ri' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+  Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('rdoc', 'ri')
diff --git a/bundler_stubs/rspec b/bundler_stubs/rspec
new file mode 100755 (executable)
index 0000000..0c86b5c
--- /dev/null
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'rspec' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+  Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('rspec-core', 'rspec')
index 6b33dd8e3dbfc92238b3c76aadcb5b5201103079..77d7ad2b42dbf19531a3684ea4a41cb23fbbcb31 100644 (file)
@@ -71,6 +71,20 @@ module ErdHandler
         c1.should_not == c2
       end
 
+      it "reads and creates an ERD with subclassing" do
+        erd = Erd.new
+        erd.read(File.new("spec/fixtures/two_boxes_one_contained_erd.xml"))
+        erd.mark.should == 4.5
+        erd.should have(2).vertices
+        erd.should have(0).edges
+
+        erd.vertices[0].should have(0).neighbours
+        erd.vertices[1].should have(0).neighbours
+        
+        erd.vertices[0].within?(erd.vertices[1]).should be(true)
+        erd.vertices[1].should be_contains(erd.vertices[0])
+      end
+      
       it "reads and creates full diagram" do
         erd = Erd.new
         erd.read(File.new("spec/fixtures/complex_erd.xml"))
diff --git a/spec/fixtures/two_boxes_one_contained_erd.xml b/spec/fixtures/two_boxes_one_contained_erd.xml
new file mode 100644 (file)
index 0000000..356c943
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><Drawing
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   name="Untitled" mark="4.5">
+
+<box id="0" name="Unit" mark="0.0">
+  <location x="87.0" y="69.0"/>
+  <size width="80.0" height="40.0"/>
+  <comment></comment>
+</box>
+
+<box id="1" name="Employee" mark="0.0">
+  <location x="80.0" y="60.0"/>
+  <size width="180.0" height="140.0"/>
+  <comment></comment>
+</box>
+
+</Drawing>
\ No newline at end of file