Revision: 806 http://trac.macosforge.org/projects/ruby/changeset/806 Author: eloy.de.enige@gmail.com Date: 2009-01-22 08:30:41 -0800 (Thu, 22 Jan 2009) Log Message: ----------- Cleaned mappings_test.rb a bit. Make sure that defined mappings and loaded frameworks etc are cleaned up at the end of the test case. Modified Paths: -------------- MacRuby/trunk/test-macruby/cases/hotcocoa/mappings_test.rb Modified: MacRuby/trunk/test-macruby/cases/hotcocoa/mappings_test.rb =================================================================== --- MacRuby/trunk/test-macruby/cases/hotcocoa/mappings_test.rb 2009-01-22 16:30:36 UTC (rev 805) +++ MacRuby/trunk/test-macruby/cases/hotcocoa/mappings_test.rb 2009-01-22 16:30:41 UTC (rev 806) @@ -23,6 +23,7 @@ after do Mappings.mappings[:klass] = nil Mappings.frameworks["theframework"] = nil + Mappings.loaded_frameworks.delete('theframework') end it "should have two Hash attributes named #mappings and #frameworks" do @@ -62,8 +63,7 @@ it "should create a mapping to a class in a framework with #map" do mock = Mock.new - eval "class ::ClassInTheFrameWork; end" - Mappings.map(:klass => 'ClassInTheFrameWork', :framework => 'TheFramework') do + Mappings.map(:klass => 'SampleClass', :framework => 'TheFramework') do mock.call! end Mappings.frameworks["theframework"].last.call @@ -90,7 +90,7 @@ it "should resolve a constant when a framework, that's registered with #map, is loaded" do assert_nothing_raised(NameError) do - Mappings.map(:klass => 'ClassFromFramework', :framework => 'TheFrameworkAfterLoad') {} + Mappings.map(:klass => 'ClassFromFramework', :framework => 'TheFramework') {} end # The mapping should not yet exist @@ -98,7 +98,7 @@ # now we actually define the class and fake the loading of the framework eval "class ::ClassFromFramework; end" - Mappings.framework_loaded('TheFrameworkAfterLoad') + Mappings.framework_loaded('TheFramework') # It should be loaded by now assert_equal ClassFromFramework, Mappings.mappings[:klass].control_class