Skip to content

Commit

Permalink
Extract common methods as parent class's ones
Browse files Browse the repository at this point in the history
  • Loading branch information
KitaitiMakoto committed Dec 22, 2014
1 parent fa6b0ea commit 6936b81
Showing 1 changed file with 13 additions and 23 deletions.
36 changes: 13 additions & 23 deletions test/epub-searcher/database_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
require 'epub-searcher/epub-document'

class TestDatabase < Test::Unit::TestCase
class TestSetup < self
def setup
@database = EPUBSearcher::Database.new
@database.db_path = db_path
remove_db_directory
end
def setup
@database = EPUBSearcher::Database.new
@database.db_path = db_path
remove_db_directory
end

def teardown
remove_db_directory
end
def teardown
remove_db_directory
end

def remove_db_directory
FileUtils.rm_rf(File.dirname(@database.db_path))
end
def remove_db_directory
FileUtils.rm_rf(File.dirname(@database.db_path))
end

class TestSetup < self
def test_setup_database
@database.setup_database

Expand All @@ -34,20 +34,10 @@ def test_setup_database

class TestLoadRecords < self
def setup
@database = EPUBSearcher::Database.new
@database.db_path = db_path
remove_db_directory
super
@database.setup_database
end

def teardown
remove_db_directory
end

def remove_db_directory
FileUtils.rm_rf(File.dirname(@database.db_path))
end

def test_load_epub_documents
documents = Array.new
documents << EPUBSearcher::EPUBDocument.open(fixture_path('empty_contributors_single_spine.epub'))
Expand Down

0 comments on commit 6936b81

Please sign in to comment.