Sha256: 7ee78252ec29f69ed586737e72aed4bd57b21795962568c8cc705321203da8f9

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

# deletes the working database and recreates it 
# reassignes ORD and DB
def reset_database
  db =  ActiveOrient.database

#  ORD.database_classes.reverse.each do | klass_name |
#    klass =  ActiveOrient::Model.orientdb_class name: klass_name
#    klass.delete_class  rescue nil
#  end
  ORD.delete_database database: db
  Object.send :remove_const, :ORD 
  Object.send :remove_const, :DB
  ActiveOrient.database =  db
  Object.send :const_set, :ORD, ActiveOrient::OrientDB.new( preallocate: true )
  if OrientDB::UsingJava
    Object.send :const_set, :DB,  ActiveOrient::API.new( preallocate: false)
  else
    Object.send :const_set,  :DB, ActiveOrient::OrientDB.new( preallocate: true )
  end
end


 shared_examples_for 'correct allocated classes' do |input|
   it "has allocated all classes" do
    case input
    when Array
      input.each{|y| expect( ORD.database_classes ).to include ORD.classname(y) }
      expect( classes ).to have( input.size ).items
    when Hash
    else  
      expect( classes ).to be_kind_of ActiveOrient::Model

    end
   end

 end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active-orient-0.5 examples/time_graph/spec/rest_helper.rb