KITAITI Makoto
null+****@clear*****
Tue Dec 23 09:02:05 JST 2014
KITAITI Makoto 2014-12-23 09:02:05 +0900 (Tue, 23 Dec 2014) New Revision: 4d882da7b310806ba2640b22b03af820afb51877 https://github.com/ranguba/epub-searcher/commit/4d882da7b310806ba2640b22b03af820afb51877 Message: Use Capybara for test Modified files: Gemfile test/epub-searcher/database_test.rb test/epub-searcher/epub_document_test.rb test/epub-searcher/remote_database_test.rb test/test_config.rb Modified: Gemfile (+1 -0) =================================================================== --- Gemfile 2014-12-23 08:30:21 +0900 (1fb83f8) +++ Gemfile 2014-12-23 09:02:05 +0900 (a920c64) @@ -16,6 +16,7 @@ group :test do gem 'mocha' gem 'shoulda' gem 'rack-test', :require => 'rack/test' + gem 'test-unit-capybara', :require => 'test/unit/capybara' end group :development do Modified: test/epub-searcher/database_test.rb (+1 -0) =================================================================== --- test/epub-searcher/database_test.rb 2014-12-23 08:30:21 +0900 (6658a80) +++ test/epub-searcher/database_test.rb 2014-12-23 09:02:05 +0900 (5da1cbe) @@ -13,6 +13,7 @@ class TestDatabase < Test::Unit::TestCase end def teardown + super remove_db_directory end Modified: test/epub-searcher/epub_document_test.rb (+1 -0) =================================================================== --- test/epub-searcher/epub_document_test.rb 2014-12-23 08:30:21 +0900 (7d8d340) +++ test/epub-searcher/epub_document_test.rb 2014-12-23 09:02:05 +0900 (12664da) @@ -122,6 +122,7 @@ class TestEPUBDocument < Test::Unit::TestCase end def teardown + super remove_temporary_directory end Modified: test/epub-searcher/remote_database_test.rb (+2 -0) =================================================================== --- test/epub-searcher/remote_database_test.rb 2014-12-23 08:30:21 +0900 (723c531) +++ test/epub-searcher/remote_database_test.rb 2014-12-23 09:02:05 +0900 (25ed286) @@ -7,6 +7,7 @@ class TestRemoteDatabase < Test::Unit::TestCase end def teardown + super @database.close end @@ -44,6 +45,7 @@ class TestRemoteDatabase < Test::Unit::TestCase end def teardown + super @database.close end Modified: test/test_config.rb (+8 -0) =================================================================== --- test/test_config.rb 2014-12-23 08:30:21 +0900 (8fa6daa) +++ test/test_config.rb 2014-12-23 09:02:05 +0900 (786a961) @@ -4,8 +4,11 @@ require File.expand_path(File.dirname(__FILE__) + "/../config/boot") require "test/unit" +Capybara.app = Padrino.application + class Test::Unit::TestCase include Rack::Test::Methods + include Capybara::DSL # You can use this method to custom specify a Rack app # you want rack-test to invoke: @@ -21,6 +24,11 @@ class Test::Unit::TestCase @app ||= Padrino.application end + def teardown + Capybara.reset_sessions! + Capybara.use_default_driver + end + def normalize_newline(text) text.gsub(/(?:\r\n)+/, "\r\n") end -------------- next part -------------- HTML����������������������������... 下载