Add fdb_spec.rb and refactoring.