Kouhei Sutou
null+****@clear*****
Wed Jan 1 23:33:52 JST 2014
Kouhei Sutou 2014-01-01 23:33:52 +0900 (Wed, 01 Jan 2014) New Revision: 7cbf2c38fe7f4a48f1bf67bcf82ad8d6aca191fa https://github.com/ranguba/chupa-text/commit/7cbf2c38fe7f4a48f1bf67bcf82ad8d6aca191fa Message: Use temporary content-type registry in test Modified files: lib/chupa-text/content-type.rb test/test-data.rb Modified: lib/chupa-text/content-type.rb (+11 -0) =================================================================== --- lib/chupa-text/content-type.rb 2014-01-01 23:27:15 +0900 (80fa05a) +++ lib/chupa-text/content-type.rb 2014-01-01 23:33:52 +0900 (0a94265) @@ -19,9 +19,20 @@ require "chupa-text/content-type-registry" module ChupaText module ContentType class << self + # @return [ContentTypeRegistry] The content-type registry for + # this process. def registry @@registry ||= ContentTypeRegistry.new end + + # Normally, this method should not be used. It is just for test. + # + # @param [ContenTypeRegistry, nil] registry + # The new content-type registry for this process. + # If you specify `nil`, reset the registry. + def registry=(registry) + @@registry = registry + end end end end Modified: test/test-data.rb (+7 -1) =================================================================== --- test/test-data.rb 2014-01-01 23:27:15 +0900 (c1fc560) +++ test/test-data.rb 2014-01-01 23:33:52 +0900 (afc878c) @@ -17,7 +17,13 @@ class TestData < Test::Unit::TestCase def setup @data = ChupaText::Data.new - ChupaText::ContentType.registry.clear + @registry = ChupaText::ContentTypeRegistry.new + @original_registry = ChupaText::ContentType.registry + ChupaText::ContentType.registry = @registry + end + + def teardown + ChupaText::ContentType.registry = @original_registry end sub_test_case("content-type") do -------------- next part -------------- HTML����������������������������...Download