spec/phone_spec/app/spec/database_spec.rb in rhodes-3.5.1.12 vs spec/phone_spec/app/spec/database_spec.rb in rhodes-5.5.0

- old
+ new

@@ -1,6 +1,6 @@ - # +# # database_spec.rb # rhodes # # Copyright (C) 2012 Rhomobile, Inc. All rights reserved. # @@ -22,11 +22,11 @@ #require 'fileutils' describe "Database_test" do before(:all) do - SyncEngine.set_threaded_mode(false) + # SyncEngine.set_threaded_mode(false) ::Rhom::Rhom.database_full_reset_and_logout end @@ -40,11 +40,12 @@ else content = File.read(src) end File.open(File.join( dst_dir, File.basename(src) ), "wb"){|f| f.write(content) } end - + +if System.get_property('platform') != 'WP8' it "should export database Database spec" do file_name = File.join(Rho::RhoApplication::get_model_path('app','BlobBulkTest_s'), 'blob_bulk_test_s.png') copy_file(file_name, Rho::RhoApplication::get_blob_folder() ) file_name = File.join(Rho::RhoApplication::get_blob_folder(), 'blob_bulk_test_s.png') File.exists?(file_name).should == true @@ -84,80 +85,10 @@ File.delete(exportPath) File.exists?(exportPath).should == false end - it "should export database after blob bulk sync Database spec" do - Rhom::Rhom.database_full_reset - SyncEngine.set_syncserver('http://store-bulk.rhohub.com/application') - login_name = System.get_property('platform') + System.get_property('device_name') - res = ::Rho::RhoSupport::parse_query_parameters SyncEngine.login('login_name', '', "/app/Settings/login_callback") - res['error_code'].to_i.should == ::Rho::RhoError::ERR_NONE - SyncEngine.logged_in.should == 1 - - sleep(15) - - Rho::RhoConfig.bulksync_state='0' - res = ::Rho::RhoSupport::parse_query_parameters SyncEngine.dosync - - res['status'].should == 'complete' - res['error_code'].to_i.should == ::Rho::RhoError::ERR_NONE - - items = BlobBulkTest.find(:all) - items.size.should_not == 0 - pbSize = items.size - items.each do |item| - path = File.join(Rho::RhoApplication::get_blob_path(item.image_uri)) - puts "item = #{item.inspect}, path = #{path}" - File.exists?(path).should == true - end - items = BlobBulkTest_s.find(:all) - items.size.should_not == 0 - shSize = items.size - items.each do |item| - path = File.join(Rho::RhoApplication::get_blob_path(item.image_uri)) - puts "item = #{item.inspect}, path = #{path}" - File.exists?(path).should == true - end - - exportPath = ::Rhom::Rhom.database_export('user') - exportPath.should_not be_nil - File.exists?(exportPath).should == true - File.size(exportPath).should_not == 0 - - Rhom::Rhom.database_full_reset - - items = BlobBulkTest_s.find(:all) - puts "BlobBulkTest_s = #{items}" - items.size.should == 0 - - items = BlobBulkTest.find(:all) - puts "BlobBulkTest = #{items}" - items.size.should == 0 - - ::Rhom::Rhom.database_import('user',exportPath).should == true - - items = BlobBulkTest_s.find(:all) - items.size.should == shSize - items.each do |item| - path = File.join(Rho::RhoApplication::get_blob_path(item.image_uri)) - puts "item = #{item.inspect}, path = #{path}" - File.exists?(path).should == true - end - - items = BlobBulkTest.find(:all) - items.size.should == pbSize - items.each do |item| - path = File.join(Rho::RhoApplication::get_blob_path(item.image_uri)) - puts "item = #{item.inspect}, path = #{path}" - File.exists?(path).should == true - end - - File.delete(exportPath) - File.exists?(exportPath).should == false - end - it "should reset database Database spec" do ::Rhom::Rhom.database_full_reset_and_logout end it "should import database Database spec" do @@ -173,7 +104,8 @@ File.exists?(File.join(Rho::RhoApplication::get_blob_folder(),item.image_uri)).should == true end it "should import invalid data and rollback" do end +end end \ No newline at end of file