From: Neil Smith Date: Fri, 29 Jun 2012 15:07:52 +0000 (+0100) Subject: Added test for ERD subclassing notation X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=f55cef415b384cf2004cf984cb0aaf6bd87ee922;p=erd-marker.git Added test for ERD subclassing notation --- diff --git a/bundler_stubs/autospec b/bundler_stubs/autospec new file mode 100755 index 0000000..64dcb9c --- /dev/null +++ b/bundler_stubs/autospec @@ -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 index 0000000..c70e238 --- /dev/null +++ b/bundler_stubs/htmldiff @@ -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 index 0000000..8e3524a --- /dev/null +++ b/bundler_stubs/ldiff @@ -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 index 0000000..26c7a2d --- /dev/null +++ b/bundler_stubs/rake @@ -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 index 0000000..90f2517 --- /dev/null +++ b/bundler_stubs/ri @@ -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 index 0000000..0c86b5c --- /dev/null +++ b/bundler_stubs/rspec @@ -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') diff --git a/spec/erd_handler/erd_spec.rb b/spec/erd_handler/erd_spec.rb index 6b33dd8..77d7ad2 100644 --- a/spec/erd_handler/erd_spec.rb +++ b/spec/erd_handler/erd_spec.rb @@ -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 index 0000000..356c943 --- /dev/null +++ b/spec/fixtures/two_boxes_one_contained_erd.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + \ No newline at end of file