rhodes 2.1.0 → 2.2.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/README.textile +4 -5
- data/Rakefile +8 -1
- data/lib/build/jake.rb +22 -16
- data/lib/extensions/rhoxml/rexml/cdata.rb +67 -0
- data/lib/extensions/rhoxml/rexml/document.rb +2 -116
- data/lib/extensions/rhoxml/rexml/element.rb +1 -1
- data/lib/extensions/rhoxml/rexml/text.rb +117 -0
- data/lib/framework/rho/render.rb +19 -11
- data/lib/framework/rho/rho.rb +17 -10
- data/lib/framework/rho/rhobluetooth.rb +103 -0
- data/lib/framework/rho/rhocontroller.rb +2 -0
- data/lib/framework/rho/rhoevent.rb +43 -0
- data/lib/framework/rho/rhoevent_bb.rb +80 -0
- data/lib/framework/rho/rhoevent_c.rb +47 -0
- data/lib/framework/rhodes.rb +2 -2
- data/lib/framework/rhom/rhom_db_adapter.rb +2 -1
- data/lib/framework/rhom/rhom_model.rb +9 -3
- data/lib/framework/rhom/rhom_object_factory.rb +46 -22
- data/lib/framework/rhom/rhom_source.rb +12 -10
- data/lib/framework/version.rb +2 -2
- data/lib/rhodes.rb +2 -2
- data/platform/android/Rhodes/AndroidManifest.xml +23 -2
- data/platform/android/Rhodes/gen/com/rhomobile/rhodes/R.java +54 -38
- data/platform/android/Rhodes/jni/include/rhodes.h +3 -0
- data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +2 -2
- data/platform/android/Rhodes/jni/include/rhodes/details/rhojava.inc +4 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesService.h +16 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_bluetooth_RhoBluetoothManager.h +21 -0
- data/platform/android/Rhodes/jni/src/bluetooth.cpp +169 -0
- data/platform/android/Rhodes/jni/src/callbacks.cpp +10 -0
- data/platform/android/Rhodes/jni/src/event.cpp +429 -0
- data/platform/android/Rhodes/jni/src/fileapi.cpp +51 -1
- data/platform/android/Rhodes/jni/src/rhodes.cpp +16 -0
- data/platform/android/Rhodes/jni/src/sslimpl.cpp +3 -0
- data/platform/android/Rhodes/res/layout/bt_device_list.xml +42 -0
- data/platform/android/Rhodes/res/layout/bt_device_name.xml +7 -0
- data/platform/android/Rhodes/res/values/strings.xml +8 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/AndroidR.java +14 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +2 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Push.java +7 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +58 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushService.java +53 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +8 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +144 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/IRhoBluetoothManager.java +66 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothDeviceListActivity.java +201 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManager.java +139 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerNew.java +401 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerOld.java +136 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothSession.java +457 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/UUIDHelper.java +71 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +12 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/Event.java +19 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +261 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +4 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/MailUriHandler.java +10 -2
- data/platform/android/build/RhodesSRC_build.files +33 -22
- data/platform/android/build/android.rake +198 -27
- data/platform/android/build/librhodes_build.files +3 -1
- data/platform/android/build/libruby_build.files +4 -1
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBResult.java +2 -2
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBRowResult.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Expression.java +7 -4
- data/platform/bb/Hsqldb/src/org/hsqldb/Like.java +3 -3
- data/platform/bb/Hsqldb/src/org/hsqldb/Table.java +3 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Tokenizer.java +1 -1
- data/platform/bb/RubyVM/RubyVM.jdp +1 -0
- data/platform/bb/RubyVM/src/com/rho/RhoConf.java +108 -1
- data/platform/bb/RubyVM/src/com/rho/RhoLogConf.java +7 -1
- data/platform/bb/RubyVM/src/com/rho/RhoRuby.java +7 -4
- data/platform/bb/RubyVM/src/com/rho/ThreadQueue.java +7 -1
- data/platform/bb/RubyVM/src/com/rho/net/AsyncHttp.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/net/NetRequest.java +21 -23
- data/platform/bb/RubyVM/src/com/rho/net/RhoConnection.java +19 -10
- data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +8 -0
- data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +3 -0
- data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +14 -17
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyFile.java +7 -5
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RhoSupport.java +2 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyRuntime.java +10 -1
- data/platform/bb/RubyVM/src/j2me/io/File.java +7 -6
- data/platform/bb/build/RubyVM_build.files +412 -412
- data/platform/bb/build/bb.rake +42 -18
- data/platform/bb/build/hsqldb_build.files +151 -151
- data/platform/bb/build/rhodes_build.files +44 -40
- data/platform/bb/rhodes/platform/5.0/com/rho/BrowserAdapter5.java +2 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +237 -0
- data/platform/bb/rhodes/platform/common/com/rho/RhodesApplicationPlatform.java +14 -0
- data/platform/bb/rhodes/rhodes.jdp +6 -1
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +7 -1
- data/platform/bb/rhodes/src/com/rho/RhodesApplicationPlatform.java +14 -0
- data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +62 -76
- data/platform/bb/rhodes/src/com/rho/rubyext/RhoCalendar.java +660 -0
- data/platform/bb/rhodes/src/{rhomobile → com/rho/rubyext}/RhoPhonebook.java +95 -38
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +22 -1
- data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +26 -6
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +21 -7
- data/platform/bb/rhodes/src/rhomobile/bluetooth/BluetoothManager.java +528 -0
- data/platform/bb/rhodes/src/rhomobile/bluetooth/BluetoothPort.java +281 -0
- data/platform/bb/rhodes/src/rhomobile/bluetooth/BluetoothScreen.java +119 -0
- data/platform/bb/rhodes/src/rhomobile/camera/CameraFilesListener.java +2 -2
- data/platform/iphone/Classes/AppManager/AppManager.m +70 -7
- data/platform/iphone/Classes/Bluetooth/Bluetooth.h +72 -0
- data/platform/iphone/Classes/Bluetooth/Bluetooth.m +414 -0
- data/platform/iphone/Classes/Event/Event.h +12 -0
- data/platform/iphone/Classes/Event/Event.m +300 -0
- data/platform/iphone/Classes/LogOptionsController.h +2 -1
- data/platform/iphone/Classes/LogOptionsController.m +1 -1
- data/platform/iphone/Classes/LogViewController.h +2 -1
- data/platform/iphone/Classes/MapView/MapViewController.h +2 -1
- data/platform/iphone/Classes/RhoViewController.h +16 -0
- data/platform/iphone/Classes/RhoViewController.m +20 -0
- data/platform/iphone/Classes/Rhodes.h +12 -0
- data/platform/iphone/Classes/Rhodes.m +34 -6
- data/platform/iphone/Classes/Signature/SignatureViewController.h +2 -2
- data/platform/iphone/Classes/Signature/SignatureViewController.m +0 -10
- data/platform/iphone/Classes/SimpleMainView.h +2 -2
- data/platform/iphone/Classes/SimpleMainView.m +5 -14
- data/platform/iphone/Classes/SplashViewController.h +2 -2
- data/platform/iphone/Classes/TabbedMainView.h +2 -2
- data/platform/iphone/Classes/TabbedMainView.m +5 -10
- data/platform/iphone/Info.plist +5 -5
- data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +39 -0
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +47 -4
- data/platform/osx/Rhodes Debugger/NoodleLineNumberView.m +3 -2
- data/platform/shared/common/AutoPointer.h +3 -0
- data/platform/shared/common/RhoConf.cpp +2 -1
- data/platform/shared/common/RhoThread.h +1 -1
- data/platform/shared/common/RhoTime.h +3 -3
- data/platform/shared/common/RhodesApp.cpp +75 -23
- data/platform/shared/common/RhodesApp.h +4 -0
- data/platform/shared/common/RhodesAppBase.h +2 -0
- data/platform/shared/common/ThreadQueue.cpp +23 -18
- data/platform/shared/common/ThreadQueue.h +2 -0
- data/platform/shared/db/res/db/syncdb.schema +39 -39
- data/platform/shared/logging/RhoLogConf.cpp +58 -3
- data/platform/shared/logging/RhoLogConf.h +3 -1
- data/platform/shared/net/CURLNetRequest.cpp +17 -6
- data/platform/shared/net/HttpServer.cpp +125 -25
- data/platform/shared/net/HttpServer.h +4 -3
- data/platform/shared/ruby/ext/bluetooth/bluetooth.i +56 -0
- data/platform/shared/ruby/ext/bluetooth/bluetooth_wrap.c +2563 -0
- data/platform/shared/ruby/ext/calendar/calendar.i +28 -0
- data/platform/shared/ruby/ext/calendar/calendar_wrap.c +2251 -0
- data/platform/shared/ruby/ext/calendar/event.h +41 -0
- data/platform/shared/ruby/ext/calendar/event.i +28 -0
- data/platform/shared/ruby/ext/calendar/event_wrap.c +2151 -0
- data/platform/shared/ruby/ext/rho/rhoruby.c +103 -3
- data/platform/shared/ruby/ext/rho/rhoruby.h +16 -2
- data/platform/shared/ruby/ext/rhoconf/rhoconf.i +12 -0
- data/platform/shared/ruby/ext/rhoconf/rhoconf_wrap.c +101 -0
- data/platform/shared/ruby/ext/system/system.i +14 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +2568 -2208
- data/platform/shared/ruby/main.c +8 -0
- data/platform/shared/rubyext/GeoLocation.cpp +6 -3
- data/platform/shared/rubyext/System.cpp +14 -0
- data/platform/shared/sync/SyncEngine.cpp +9 -1
- data/platform/shared/sync/SyncNotify.cpp +16 -8
- data/platform/shared/sync/SyncNotify.h +1 -0
- data/platform/shared/sync/SyncThread.cpp +7 -12
- data/platform/shared/sync/SyncThread.h +5 -3
- data/platform/wm/build/wm.rake +7 -1
- data/platform/wm/rhodes/Alert.cpp +1 -1
- data/platform/wm/rhodes/MainWindow.cpp +28 -0
- data/platform/wm/rhodes/MainWindow.h +9 -0
- data/platform/wm/rhodes/OutlookApp.cpp +72 -0
- data/platform/wm/rhodes/OutlookApp.h +22 -0
- data/platform/wm/rhodes/Rhodes.cpp +8 -0
- data/platform/wm/rhodes/Rhodes.rc +31 -0
- data/platform/wm/rhodes/bluetooth/Bluetooth.cpp +1274 -0
- data/platform/wm/rhodes/bluetooth/Bluetooth.h +321 -0
- data/platform/wm/rhodes/phonebook/NativeAddressBook.cpp +37 -70
- data/platform/wm/rhodes/phonebook/NativeAddressBook.h +0 -4
- data/platform/wm/rhodes/resource.h +8 -1
- data/platform/wm/rhodes/rho/net/NetRequest.cpp +4 -0
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +6 -4
- data/platform/wm/rhodes/rho/rubyext/calendar.cpp +487 -0
- data/platform/wm/rhodes/rhodes.vcproj +28 -11
- data/platform/wm/rhodes/stdafx.h +1 -0
- data/platform/wm/rubylib/rubylib.vcproj +32 -0
- data/rakefile.rb +8 -1
- data/res/generators/templates/application/Rakefile +1 -1
- data/res/generators/templates/application/app/layout.erb +4 -1
- data/res/generators/templates/application/build.yml +0 -1
- data/res/generators/templates/application/public/css/iphone.css +2 -2
- data/res/generators/templates/application/public/jqtouch/jqtouch-iphone.css +9 -0
- data/res/generators/templates/application/public/jqtouch/jqtouch.css +1 -5
- data/res/generators/templates/application/public/jqtouch/jqtouch.js +3 -2
- data/rhodes.gemspec +1 -1
- data/spec/perfomance_spec/app/Benchmark/benchmark.rb +4 -0
- data/spec/perfomance_spec/app/Benchmark/bulk_results.erb +13 -0
- data/spec/perfomance_spec/app/Benchmark/controller.rb +178 -0
- data/spec/perfomance_spec/app/Benchmark/create_results.erb +13 -0
- data/spec/perfomance_spec/app/Benchmark/customers.erb +35 -0
- data/spec/perfomance_spec/app/Benchmark/index.erb +9 -0
- data/spec/perfomance_spec/app/Benchmark/products.erb +25 -0
- data/spec/perfomance_spec/app/Benchmark/search_results.erb +13 -0
- data/spec/perfomance_spec/app/Customer/customer.rb +6 -0
- data/spec/perfomance_spec/app/Perftest/index.erb +5 -0
- data/spec/perfomance_spec/app/Product/index.erb +25 -0
- data/spec/perfomance_spec/app/Product/product.rb +6 -0
- data/spec/perfomance_spec/app/helpers/application_helper.rb +126 -0
- data/spec/perfomance_spec/app/helpers/browser_helper.rb +18 -0
- data/spec/perfomance_spec/rhoconfig.txt +1 -1
- data/spec/phone_spec/app/Account_s/account_s.rb +5 -2
- data/spec/phone_spec/app/Case/case.rb +1 -0
- data/spec/phone_spec/app/Case_s/case_s.rb +2 -0
- data/spec/phone_spec/app/Data/perftest.json +35 -0
- data/spec/phone_spec/app/Data/testCDATA.xml +11 -0
- data/spec/phone_spec/app/Product/product.rb +1 -1
- data/spec/phone_spec/app/{Spec → spec}/asynchttp_spec.rb +66 -17
- data/spec/phone_spec/app/{Spec → spec}/barcode_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/blobsync_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/bsearch_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/bulksync_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/contacts_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/crypt_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/date_spec.rb +0 -0
- data/spec/phone_spec/app/spec/events_spec.rb +199 -0
- data/spec/phone_spec/app/{Spec → spec}/fixtures/client_info.txt +0 -0
- data/spec/phone_spec/app/{Spec → spec}/fixtures/object_values.txt +0 -0
- data/spec/phone_spec/app/{Spec → spec}/json_spec.rb +11 -2
- data/spec/phone_spec/app/{Spec → spec}/mapview_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/nativebar_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/navbar_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/pagination/fixtures/object_values.txt +0 -0
- data/spec/phone_spec/app/{Spec → spec}/rho_controller_spec.rb +5 -0
- data/spec/phone_spec/app/{Spec → spec}/rho_spec.rb +48 -0
- data/spec/phone_spec/app/{Spec → spec}/rhofile_spec.rb +9 -6
- data/spec/phone_spec/app/{Spec → spec}/rhom_object_spec.rb +188 -9
- data/spec/phone_spec/app/{Spec → spec}/syncengine_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/xml_spec.rb +15 -0
- data/spec/phone_spec/app/{Spec → spec}/xruby_spec.rb +0 -0
- data/spec/phone_spec/app/spec_runner.rb +4 -1
- data/spec/phone_spec/build.yml +2 -1
- metadata +95 -31
- data/platform/bb/rhodes/platform/5.0/com/rho/RhoMainScreen.java +0 -36
- data/platform/bb/rhodes/platform/6.0/com/rho/BrowserAdapter5.java +0 -155
- data/platform/bb/rhodes/platform/6.0/com/rho/RhoMainScreen.java +0 -36
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,199 @@
|
|
1
|
+
require 'rho/rhoevent'
|
2
|
+
|
3
|
+
describe "Events" do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
$calendar_supported = true
|
7
|
+
begin
|
8
|
+
events = Rho::RhoEvent.find(:all)
|
9
|
+
rescue => e
|
10
|
+
$calendar_supported = false
|
11
|
+
puts "Calendar is not supported: #{e.to_s}"
|
12
|
+
end
|
13
|
+
if $calendar_supported
|
14
|
+
events.each do |event|
|
15
|
+
Rho::RhoEvent.destroy(event['id'])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should create" do
|
21
|
+
return unless $calendar_supported
|
22
|
+
|
23
|
+
title = 'Random'
|
24
|
+
|
25
|
+
events = Rho::RhoEvent.find(:all)
|
26
|
+
#puts "events: #{events.inspect.to_s}"
|
27
|
+
events.should_not be_nil
|
28
|
+
|
29
|
+
event = {}
|
30
|
+
event['title'] = title
|
31
|
+
event['location'] = 'loc1'
|
32
|
+
event['notes'] = 'notes1'
|
33
|
+
event['reminder'] = 10 if System::get_property('platform') == 'Blackberry' || System::get_property('platform') == 'WINDOWS'
|
34
|
+
event['privacy'] = 'private'
|
35
|
+
start_date = Time.now+600
|
36
|
+
start_date -= start_date.sec #usec.to_f/1000000
|
37
|
+
end_date = Time.now+3600
|
38
|
+
end_date -= end_date.sec #usec.to_f/1000000
|
39
|
+
event['start_date'] = start_date
|
40
|
+
event['end_date'] = end_date
|
41
|
+
|
42
|
+
puts "event: #{event}"
|
43
|
+
Rho::RhoEvent.create!(event)
|
44
|
+
|
45
|
+
newevents = Rho::RhoEvent.find(:all)
|
46
|
+
#puts "newevents: #{newevents.inspect.to_s}"
|
47
|
+
newevents.should_not be_nil
|
48
|
+
|
49
|
+
newevents.size.should == 1
|
50
|
+
c = newevents[0]
|
51
|
+
puts "c: #{c}"
|
52
|
+
|
53
|
+
@id = c['id']
|
54
|
+
|
55
|
+
c['title'].should == title
|
56
|
+
c['location'].should == 'loc1'
|
57
|
+
c['notes'].should == 'notes1'
|
58
|
+
c['reminder'].should == 10 if System::get_property('platform') == 'Blackberry' || System::get_property('platform') == 'WINDOWS'
|
59
|
+
c['privacy'].should == 'private' unless System::get_property('platform') == 'APPLE'
|
60
|
+
c['start_date'].to_s.should == start_date.to_s
|
61
|
+
c['end_date'].to_s.should == end_date.to_s
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should find by dates" do
|
65
|
+
return unless $calendar_supported
|
66
|
+
|
67
|
+
start = Time.now
|
68
|
+
end_time = start + 3600
|
69
|
+
|
70
|
+
events = Rho::RhoEvent.find(:all, :start_date => start, :end_date => end_time, :find_type => 'starting',
|
71
|
+
:include_repeating => true )
|
72
|
+
|
73
|
+
events.should_not be_nil
|
74
|
+
events.size.should == 1
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should update" do
|
78
|
+
return unless $calendar_supported
|
79
|
+
|
80
|
+
#puts "id: #{@id}"
|
81
|
+
|
82
|
+
start_date = Time.now
|
83
|
+
start_date -= start_date.sec#usec.to_f/1000000
|
84
|
+
end_date = Time.now+1800
|
85
|
+
end_date -= end_date.sec #usec.to_f/1000000
|
86
|
+
|
87
|
+
Rho::RhoEvent.update_attributes( 'id' => @id, 'title' => "RANDOM", 'location' => 'loc2', 'notes' => 'notes2',
|
88
|
+
'reminder' => 15, 'privacy' => 'confidential', 'start_date' => start_date, 'end_date' => end_date )
|
89
|
+
|
90
|
+
event = Rho::RhoEvent.find(@id)
|
91
|
+
#puts "event: #{event.inspect.to_s}"
|
92
|
+
event.should_not be_nil
|
93
|
+
|
94
|
+
event['title'].should == 'RANDOM'
|
95
|
+
event['location'].should == 'loc2'
|
96
|
+
event['notes'].should == 'notes2'
|
97
|
+
event['reminder'].should == 15 if System::get_property('platform') == 'Blackberry' || System::get_property('platform') == 'WINDOWS'
|
98
|
+
event['privacy'].should == 'confidential' unless System::get_property('platform') == 'APPLE'
|
99
|
+
event['start_date'].to_s.should == start_date.to_s
|
100
|
+
event['end_date'].to_s.should == end_date.to_s
|
101
|
+
#@revision.should_not == event['revision']
|
102
|
+
end
|
103
|
+
|
104
|
+
it "should update recurrence" do
|
105
|
+
return unless $calendar_supported
|
106
|
+
|
107
|
+
# https://www.pivotaltracker.com/story/show/5484747
|
108
|
+
# https://www.pivotaltracker.com/story/show/5484751
|
109
|
+
if System::get_property('platform') == 'Blackberry' ||System.get_property('platform') == 'WINDOWS'
|
110
|
+
recValues = {'frequency'=>'daily', "interval"=>2 }
|
111
|
+
Rho::RhoEvent.update_attributes( 'id' => @id, 'recurrence' => recValues )
|
112
|
+
event = Rho::RhoEvent.find(@id)
|
113
|
+
#puts "event: #{event.inspect.to_s}"
|
114
|
+
event.should_not be_nil
|
115
|
+
event['recurrence'].should == recValues
|
116
|
+
|
117
|
+
if System::get_property('platform') == 'Blackberry'
|
118
|
+
recValues = {"frequency"=>"yearly", "interval"=>1, "end_date"=>Time.now + 60000, "days"=>[0, 0, 1, 0, 0, 0, 0], "months"=>[0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], "weeks"=>[0, 0, 1, 0, 0]}
|
119
|
+
else
|
120
|
+
recValues = {"frequency"=>"yearly", "day_of_month"=>10, "months"=>[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], "count"=>10 }
|
121
|
+
end
|
122
|
+
|
123
|
+
Rho::RhoEvent.update_attributes( 'id' => @id, 'recurrence' => recValues )
|
124
|
+
event = Rho::RhoEvent.find(@id)
|
125
|
+
#puts "event: #{event.inspect.to_s}"
|
126
|
+
event.should_not be_nil
|
127
|
+
event['recurrence']['end_date'].to_s.should == recValues['end_date'].to_s
|
128
|
+
event['recurrence']['end_date'] = ''
|
129
|
+
recValues['end_date'] = ''
|
130
|
+
#event['recurrence']['days'] = recValues['days']
|
131
|
+
event['recurrence'].should == recValues
|
132
|
+
|
133
|
+
if System::get_property('platform') == 'Blackberry'
|
134
|
+
recValues = {"frequency"=>"weekly", "interval"=>4, "end_date"=>Time.now + 60000, "days"=>[1, 1, 1, 1, 0, 0, 0]}
|
135
|
+
else
|
136
|
+
recValues = {"frequency"=>"weekly", "interval"=>4, "days"=>[1, 1, 1, 1, 0, 0, 0], "count"=>10}
|
137
|
+
end
|
138
|
+
Rho::RhoEvent.update_attributes( 'id' => @id, 'recurrence' => recValues )
|
139
|
+
event = Rho::RhoEvent.find(@id)
|
140
|
+
#puts "event: #{event.inspect.to_s}"
|
141
|
+
event.should_not be_nil
|
142
|
+
event['recurrence']['end_date'].to_s.should == recValues['end_date'].to_s
|
143
|
+
event['recurrence']['end_date'] = ''
|
144
|
+
recValues['end_date'] = ''
|
145
|
+
if System::get_property('platform') == 'Blackberry' #Bug in BB
|
146
|
+
event['recurrence']['days'] = []
|
147
|
+
recValues['days'] = []
|
148
|
+
end
|
149
|
+
|
150
|
+
event['recurrence'].should == recValues
|
151
|
+
|
152
|
+
#{"frequency"=>"weekly", "interval"=>1, "days"=>[0, 0, 0, 0, 0, 0, 1]}}]
|
153
|
+
recValues = {"frequency"=>"weekly", "interval"=>5, "days"=>[0, 1, 1, 0, 0, 0, 1] }#, "count"=>10}
|
154
|
+
Rho::RhoEvent.update_attributes( 'id' => @id, 'recurrence' => recValues )
|
155
|
+
event = Rho::RhoEvent.find(@id)
|
156
|
+
#puts "event: #{event.inspect.to_s}"
|
157
|
+
event.should_not be_nil
|
158
|
+
if System::get_property('platform') == 'Blackberry' #Bug in BB
|
159
|
+
event['recurrence']['days'] = []
|
160
|
+
recValues['days'] = []
|
161
|
+
end
|
162
|
+
|
163
|
+
event['recurrence'].should == recValues
|
164
|
+
|
165
|
+
if System::get_property('platform') == 'Blackberry'
|
166
|
+
recValues = {"frequency"=>"monthly", "interval"=>9, "days"=>[0, 0, 1, 0, 0, 0, 0], "weeks"=>[0, 0, 1, 0, 0]}
|
167
|
+
else
|
168
|
+
recValues = {"frequency"=>"monthly", "interval"=>1, "day_of_month"=>10}
|
169
|
+
end
|
170
|
+
|
171
|
+
Rho::RhoEvent.update_attributes( 'id' => @id, 'recurrence' => recValues )
|
172
|
+
event = Rho::RhoEvent.find(@id)
|
173
|
+
#puts "event: #{event.inspect.to_s}"
|
174
|
+
event.should_not be_nil
|
175
|
+
event['recurrence'].should == recValues
|
176
|
+
end
|
177
|
+
|
178
|
+
end
|
179
|
+
|
180
|
+
it "should remove" do
|
181
|
+
return unless $calendar_supported
|
182
|
+
|
183
|
+
events = Rho::RhoEvent.find(:all)
|
184
|
+
#puts "events: #{events.inspect.to_s}"
|
185
|
+
events.should_not be_nil
|
186
|
+
events.size.should >= 1
|
187
|
+
|
188
|
+
size = events.size
|
189
|
+
|
190
|
+
Rho::RhoEvent.destroy(@id)
|
191
|
+
|
192
|
+
events = Rho::RhoEvent.find(:all)
|
193
|
+
puts "new events: #{events.inspect.to_s}"
|
194
|
+
events.should_not be_nil
|
195
|
+
|
196
|
+
(size - events.size).should == 1
|
197
|
+
end
|
198
|
+
|
199
|
+
end
|
File without changes
|
File without changes
|
@@ -59,6 +59,15 @@ describe "Json" do
|
|
59
59
|
parsed["Category List"].is_a?(Array).should == true
|
60
60
|
end
|
61
61
|
|
62
|
+
it "should parse many times" do
|
63
|
+
file_name = File.join(Rho::RhoApplication::get_model_path('app','Data'), 'perftest.json')
|
64
|
+
content = File.read(file_name)
|
65
|
+
|
66
|
+
(1..100).each do |i|
|
67
|
+
Rho::JSON.parse(content)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
62
71
|
it "should webservice" do
|
63
72
|
return unless $is_network_available
|
64
73
|
|
@@ -88,9 +97,9 @@ describe "Json" do
|
|
88
97
|
require 'json'
|
89
98
|
|
90
99
|
prod = Product.create("test"=>"123")
|
91
|
-
parsed = Product.find(
|
100
|
+
parsed = Product.find(prod.object)
|
92
101
|
gen_content = ::JSON.generate(parsed)
|
93
|
-
gen_content.should == "
|
102
|
+
gen_content.should == "{\"source_id\":#{prod.source_id},\"object\":\"#{prod.object}\",\"test\":\"123\"}"
|
94
103
|
|
95
104
|
end
|
96
105
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -117,6 +117,11 @@ describe "url_for and link_to" do
|
|
117
117
|
@c.link_to("Invate",:action => :invite, :query => {:name => 'John Smith', 'address' => "http://john.smith.com"}).should == "<a href=\"/application/model/invite?name=John%20Smith&address=http%3A%2F%2Fjohn.smith.com\" >Invate</a>"
|
118
118
|
end
|
119
119
|
|
120
|
+
it "should generate link with a action" do
|
121
|
+
res = @c.url_for :controller => :Settings, :action => :login
|
122
|
+
res.should == "/application/Settings/login"
|
123
|
+
end
|
124
|
+
|
120
125
|
end #describe "url_for and link_to"
|
121
126
|
|
122
127
|
describe "redirect" do
|
@@ -69,6 +69,18 @@ describe "RhoConfig" do
|
|
69
69
|
Rho::RhoConfig.reload
|
70
70
|
Rho::RhoConfig.start_path.should == oldpath
|
71
71
|
end
|
72
|
+
|
73
|
+
it "should read log" do
|
74
|
+
log_text = Rho::RhoConfig.read_log
|
75
|
+
log_text.length.should > 0
|
76
|
+
|
77
|
+
log_text = Rho::RhoConfig.read_log(20000)
|
78
|
+
log_text.length.should <= 20000
|
79
|
+
|
80
|
+
log_text = Rho::RhoConfig.read_log(1000)
|
81
|
+
log_text.length.should == 1000
|
82
|
+
end
|
83
|
+
|
72
84
|
end
|
73
85
|
|
74
86
|
describe "RhoError" do
|
@@ -89,6 +101,42 @@ describe "RhoError" do
|
|
89
101
|
|
90
102
|
end
|
91
103
|
|
104
|
+
describe "RhomSource" do
|
105
|
+
|
106
|
+
it "should find first source" do
|
107
|
+
src = Rhom::RhomSource.find(:first)
|
108
|
+
src.should_not be_nil
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should find all source" do
|
112
|
+
srcs = Rhom::RhomSource.find(:all)
|
113
|
+
srcs.should_not be_nil
|
114
|
+
|
115
|
+
srcs.length.should > 1
|
116
|
+
end
|
117
|
+
|
118
|
+
it "should find Product_s source" do
|
119
|
+
src = Rhom::RhomSource.find(Product_s.get_source_id)
|
120
|
+
src.should_not be_nil
|
121
|
+
|
122
|
+
#src.get_lastsync_objectcount.should == 0
|
123
|
+
src.source_id.should == Product_s.get_source_id.to_i
|
124
|
+
src.name.should == "Product_s"
|
125
|
+
src.last_updated.year.should > 1960
|
126
|
+
#src.last_inserted_size.should == 0
|
127
|
+
#src.last_deleted_size.should == 0
|
128
|
+
#src.last_sync_duration.should == 0
|
129
|
+
#src.last_sync_success.should == false
|
130
|
+
#src.distinct_objects.should == 0
|
131
|
+
src.backend_refresh_time.year.should > 1960
|
132
|
+
src.partition.should == "user"
|
133
|
+
src.schema.length.should > 0
|
134
|
+
src.schema_version.length.should > 0
|
135
|
+
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
139
|
+
|
92
140
|
describe "RhoRuby" do
|
93
141
|
|
94
142
|
it "should compute string to_f to test flt_rounds" do
|
@@ -2,10 +2,13 @@ describe "RhoFile" do
|
|
2
2
|
|
3
3
|
before(:all) do
|
4
4
|
clear()
|
5
|
+
|
6
|
+
dir_name = Rho::RhoApplication::get_app_path('DataTemp')
|
7
|
+
Dir.mkdir(dir_name) unless Dir.exists?(dir_name)
|
5
8
|
end
|
6
9
|
|
7
10
|
it "should write" do
|
8
|
-
file_name = File.join(Rho::RhoApplication::
|
11
|
+
file_name = File.join(Rho::RhoApplication::get_app_path('DataTemp'), 'temp.txt')
|
9
12
|
File.delete(file_name) if File.exists?(file_name)
|
10
13
|
File.exists?(file_name).should == false
|
11
14
|
|
@@ -31,11 +34,11 @@ describe "RhoFile" do
|
|
31
34
|
end
|
32
35
|
|
33
36
|
it "should binary read/write" do
|
34
|
-
file_testname = File.join(Rho::RhoApplication::get_model_path('app','Data'), 'test.png')
|
37
|
+
file_testname = File.join(Rho::RhoApplication::get_model_path('app', 'Data'), 'test.png')
|
35
38
|
test_content = File.binread(file_testname)
|
36
39
|
File.size(file_testname).should == test_content.length
|
37
40
|
|
38
|
-
file_name = File.join(Rho::RhoApplication::
|
41
|
+
file_name = File.join(Rho::RhoApplication::get_app_path('DataTemp'), 'temp.png')
|
39
42
|
File.delete(file_name) if File.exists?(file_name)
|
40
43
|
File.exists?(file_name).should == false
|
41
44
|
|
@@ -72,7 +75,7 @@ describe "RhoFile" do
|
|
72
75
|
end
|
73
76
|
|
74
77
|
it "should dir" do
|
75
|
-
dir_name = Rho::RhoApplication::
|
78
|
+
dir_name = Rho::RhoApplication::get_app_path('cache')
|
76
79
|
Dir.mkdir(dir_name) unless Dir.exists?(dir_name)
|
77
80
|
|
78
81
|
(1..2).each do |n|
|
@@ -123,11 +126,11 @@ describe "RhoFile" do
|
|
123
126
|
|
124
127
|
def clear
|
125
128
|
(1..2).each do |n|
|
126
|
-
file_name = File.join(Rho::RhoApplication::
|
129
|
+
file_name = File.join(Rho::RhoApplication::get_app_path('cache'), "cache_test"+ n.to_s())
|
127
130
|
File.delete(file_name) if File.exists?(file_name)
|
128
131
|
end
|
129
132
|
|
130
|
-
file_name = File.join(Rho::RhoApplication::
|
133
|
+
file_name = File.join(Rho::RhoApplication::get_app_path('DataTemp'), 'temp.txt')
|
131
134
|
File.delete(file_name) if File.exists?(file_name)
|
132
135
|
end
|
133
136
|
end
|
@@ -43,6 +43,12 @@ def getCase
|
|
43
43
|
Case
|
44
44
|
end
|
45
45
|
|
46
|
+
def getCase_str
|
47
|
+
return 'Case_s' if $spec_settings[:schema_model]
|
48
|
+
|
49
|
+
'Case'
|
50
|
+
end
|
51
|
+
|
46
52
|
def clean_db_data
|
47
53
|
#Rhom::Rhom.database_full_reset(true)
|
48
54
|
::Rho::RHO.get_user_db().start_transaction
|
@@ -65,6 +71,7 @@ class Test_Helper
|
|
65
71
|
::Rho::RHO.get_user_db().update_into_table('sources',{'sync_type'=>'none'})
|
66
72
|
|
67
73
|
Rho::RhoConfig.sources[getAccount_str()]['sync_type'] = 'incremental' if $spec_settings[:sync_model]
|
74
|
+
Rho::RhoConfig.sources[getCase_str()]['sync_type'] = 'incremental' if $spec_settings[:sync_model]
|
68
75
|
clean_db_data
|
69
76
|
|
70
77
|
@source_map = nil
|
@@ -143,7 +150,7 @@ describe "Rhom::RhomObject" do
|
|
143
150
|
# getAccount.get_source_id.should == "23"
|
144
151
|
#getCase.get_source_id.should == "1"
|
145
152
|
#end
|
146
|
-
|
153
|
+
|
147
154
|
it "should dynamically assign values" do
|
148
155
|
account = getAccount.new
|
149
156
|
account.name = 'hello name'
|
@@ -235,12 +242,21 @@ describe "Rhom::RhomObject" do
|
|
235
242
|
end
|
236
243
|
|
237
244
|
it "should update attribs while save" do
|
245
|
+
records = ::Rho::RHO.get_user_db().select_from_table('changed_values','*', 'update_type' => 'update')
|
246
|
+
records.length.should == 0
|
247
|
+
|
238
248
|
acct = getAccount.find(:first)
|
239
249
|
obj_id = acct.object
|
240
250
|
acct.name = 'soccer'
|
241
251
|
acct.save
|
242
252
|
acct2 = getAccount.find(obj_id)
|
243
253
|
acct2.name.should == 'soccer'
|
254
|
+
|
255
|
+
if $spec_settings[:sync_model]
|
256
|
+
records = ::Rho::RHO.get_user_db().select_from_table('changed_values','*', 'update_type' => 'update')
|
257
|
+
records.length.should == 1
|
258
|
+
end
|
259
|
+
|
244
260
|
end
|
245
261
|
|
246
262
|
it "should create records with no attribs in database" do
|
@@ -366,6 +382,11 @@ describe "Rhom::RhomObject" do
|
|
366
382
|
@new_acct = getAccount.find("44e804f2-4933-4e20-271c-48fcecd9450d")
|
367
383
|
@new_acct.name.should == "Mobio US"
|
368
384
|
@new_acct.industry.should == "Technology"
|
385
|
+
|
386
|
+
if $spec_settings[:sync_model]
|
387
|
+
records = ::Rho::RHO.get_user_db().select_from_table('changed_values','*', 'update_type' => 'update')
|
388
|
+
records.length.should == 1
|
389
|
+
end
|
369
390
|
end
|
370
391
|
|
371
392
|
it "should fully update a record" do
|
@@ -379,6 +400,76 @@ describe "Rhom::RhomObject" do
|
|
379
400
|
|
380
401
|
@new_acct.name.should == "Mobio US"
|
381
402
|
@new_acct.industry.should == "Electronics"
|
403
|
+
|
404
|
+
if $spec_settings[:sync_model]
|
405
|
+
records = ::Rho::RHO.get_user_db().select_from_table('changed_values','*', 'update_type' => 'update')
|
406
|
+
records.length.should == 2
|
407
|
+
end
|
408
|
+
end
|
409
|
+
|
410
|
+
it "should empty attrib in a record" do
|
411
|
+
new_attributes = {"name"=>""}
|
412
|
+
@account = getAccount.find("44e804f2-4933-4e20-271c-48fcecd9450d")
|
413
|
+
@account.name.should_not == ""
|
414
|
+
@account.update_attributes(new_attributes)
|
415
|
+
@new_acct = getAccount.find("44e804f2-4933-4e20-271c-48fcecd9450d")
|
416
|
+
@new_acct.name.should == ""
|
417
|
+
@new_acct.industry.should == "Technology"
|
418
|
+
|
419
|
+
if $spec_settings[:sync_model]
|
420
|
+
records = ::Rho::RHO.get_user_db().select_from_table('changed_values','*', 'update_type' => 'update')
|
421
|
+
records.length.should == 1
|
422
|
+
end
|
423
|
+
|
424
|
+
end
|
425
|
+
|
426
|
+
it "should create a record diff case name" do
|
427
|
+
item = getAccount.create( 'propOne'=>'1', 'TwoProps'=>'2')
|
428
|
+
item.propOne.should == '1'
|
429
|
+
item.TwoProps.should == '2'
|
430
|
+
|
431
|
+
item2 = getAccount.find(item.object)
|
432
|
+
item.vars.should == item2.vars
|
433
|
+
|
434
|
+
item2.propOne.should == '1'
|
435
|
+
item2.TwoProps.should == '2'
|
436
|
+
|
437
|
+
end
|
438
|
+
|
439
|
+
it "should update a record with full mode" do
|
440
|
+
records = ::Rho::RHO.get_user_db().select_from_table('changed_values','*', 'update_type' => 'update')
|
441
|
+
records.length.should == 0
|
442
|
+
|
443
|
+
new_attributes = {"created_by_name"=>"evgeny"}
|
444
|
+
@case = getCase.find("41a4e1f1-2c0c-7e51-0495-4900dc4c072c")
|
445
|
+
@case.update_attributes(new_attributes)
|
446
|
+
@new_case = getCase.find("41a4e1f1-2c0c-7e51-0495-4900dc4c072c")
|
447
|
+
@new_case.created_by_name.should == "evgeny"
|
448
|
+
|
449
|
+
if $spec_settings[:sync_model]
|
450
|
+
records = ::Rho::RHO.get_user_db().select_from_table('changed_values','*', 'update_type' => 'update')
|
451
|
+
records.length.should == 17
|
452
|
+
end
|
453
|
+
|
454
|
+
end
|
455
|
+
|
456
|
+
it "should save a record with full mode" do
|
457
|
+
records = ::Rho::RHO.get_user_db().select_from_table('changed_values','*', 'update_type' => 'update')
|
458
|
+
records.length.should == 0
|
459
|
+
|
460
|
+
#new_attributes = {"created_by_name"=>"evgeny"}
|
461
|
+
@case = getCase.find("41a4e1f1-2c0c-7e51-0495-4900dc4c072c")
|
462
|
+
@case.created_by_name = "evgeny"
|
463
|
+
@case.save
|
464
|
+
|
465
|
+
@new_case = getCase.find("41a4e1f1-2c0c-7e51-0495-4900dc4c072c")
|
466
|
+
@new_case.created_by_name.should == "evgeny"
|
467
|
+
|
468
|
+
if $spec_settings[:sync_model]
|
469
|
+
records = ::Rho::RHO.get_user_db().select_from_table('changed_values','*', 'update_type' => 'update')
|
470
|
+
records.length.should == 17
|
471
|
+
end
|
472
|
+
|
382
473
|
end
|
383
474
|
|
384
475
|
it "should set <something>_type_<something> or <something>_object_<something> field for a record" do
|
@@ -444,6 +535,19 @@ describe "Rhom::RhomObject" do
|
|
444
535
|
@new_acct.name.should == ""
|
445
536
|
@new_acct.industry.should == "Technology"
|
446
537
|
end
|
538
|
+
|
539
|
+
|
540
|
+
it "should save an attribute to empty string" do
|
541
|
+
@account = getAccount.find('44e804f2-4933-4e20-271c-48fcecd9450d')
|
542
|
+
@acct.name.should_not == ""
|
543
|
+
@account.name = ""
|
544
|
+
@account.save
|
545
|
+
|
546
|
+
@new_acct = getAccount.find('44e804f2-4933-4e20-271c-48fcecd9450d')
|
547
|
+
|
548
|
+
@new_acct.name.should == ""
|
549
|
+
@new_acct.industry.should == "Technology"
|
550
|
+
end
|
447
551
|
|
448
552
|
it "should store only last updated value for attrib" do
|
449
553
|
new_attributes1 = {"new_name"=>"Mobio Europe"}
|
@@ -517,15 +621,13 @@ describe "Rhom::RhomObject" do
|
|
517
621
|
@accts[0].industry.should == "Technology"
|
518
622
|
end
|
519
623
|
|
520
|
-
if !defined? RHO_ME
|
521
624
|
it "should find with SQL multiple conditions" do
|
522
625
|
@acct = getAccount.find(:first, :conditions => [ "name = ? AND industry = ?", "'Mobio India'", "'Technology'" ])
|
523
626
|
@acct.name.should == "Mobio India"
|
524
627
|
@acct.industry.should == "Technology"
|
525
628
|
end
|
526
|
-
end
|
527
629
|
|
528
|
-
it "should find with advanced conditions" do
|
630
|
+
it "should find with advanced OR conditions" do
|
529
631
|
query = '%IND%'
|
530
632
|
@accts = getAccount.find( :all,
|
531
633
|
:conditions => {
|
@@ -538,12 +640,85 @@ end
|
|
538
640
|
@accts[0].industry.should == "Technology"
|
539
641
|
end
|
540
642
|
|
643
|
+
it "should NOT find with advanced OR conditions" do
|
644
|
+
query = '%IND33%'
|
645
|
+
@accts = getAccount.find( :all,
|
646
|
+
:conditions => {
|
647
|
+
{:func=>'UPPER', :name=>'name', :op=>'LIKE'} => query,
|
648
|
+
{:func=>'UPPER', :name=>'industry', :op=>'LIKE'} => query},
|
649
|
+
:op => 'OR', :select => ['name','industry'])
|
650
|
+
|
651
|
+
@accts.length.should == 0
|
652
|
+
end
|
653
|
+
|
654
|
+
it "should find with advanced AND conditions" do
|
655
|
+
query = '%IND%'
|
656
|
+
query2 = '%chnolo%' #LIKE is case insensitive by default
|
657
|
+
@accts = getAccount.find( :all,
|
658
|
+
:conditions => {
|
659
|
+
{:func=>'UPPER', :name=>'name', :op=>'LIKE'} => query,
|
660
|
+
{:func=>'UPPER', :name=>'industry', :op=>'LIKE'} => query2
|
661
|
+
},
|
662
|
+
:op => 'AND',
|
663
|
+
:select => ['name','industry'])
|
664
|
+
|
665
|
+
@accts.length.should == 1
|
666
|
+
@accts[0].name.should == "Mobio India"
|
667
|
+
@accts[0].industry.should == "Technology"
|
668
|
+
end
|
669
|
+
|
670
|
+
it "should NOT find with advanced AND conditions" do
|
671
|
+
query = '%IND123%'
|
672
|
+
query2 = '%chnolo%' #LIKE is case insensitive by default
|
673
|
+
@accts = getAccount.find( :all,
|
674
|
+
:conditions => {
|
675
|
+
{:func=>'UPPER', :name=>'name', :op=>'LIKE'} => query,
|
676
|
+
{:func=>'UPPER', :name=>'industry', :op=>'LIKE'} => query2},
|
677
|
+
:op => 'AND', :select => ['name','industry'])
|
678
|
+
|
679
|
+
@accts.length.should == 0
|
680
|
+
end
|
681
|
+
|
682
|
+
it "should count with advanced AND conditions" do
|
683
|
+
query = '%IND%'
|
684
|
+
query2 = '%chnolo%' #LIKE is case insensitive by default
|
685
|
+
nCount = getAccount.find( :count,
|
686
|
+
:conditions => {
|
687
|
+
{:func=>'UPPER', :name=>'name', :op=>'LIKE'} => query,
|
688
|
+
{:func=>'UPPER', :name=>'industry', :op=>'LIKE'} => query2},
|
689
|
+
:op => 'AND' )
|
690
|
+
|
691
|
+
nCount.should == 1
|
692
|
+
end
|
693
|
+
|
694
|
+
it "should count 0 with advanced AND conditions" do
|
695
|
+
query = '%IND123%'
|
696
|
+
query2 = '%chnolo%' #LIKE is case insensitive by default
|
697
|
+
nCount = getAccount.find( :count,
|
698
|
+
:conditions => {
|
699
|
+
{:func=>'UPPER', :name=>'name', :op=>'LIKE'} => query,
|
700
|
+
{:func=>'UPPER', :name=>'industry', :op=>'LIKE'} => query2},
|
701
|
+
:op => 'AND')
|
702
|
+
|
703
|
+
nCount.should == 0
|
704
|
+
end
|
705
|
+
|
706
|
+
it "should search with LIKE" do
|
707
|
+
query2 = '%CHNolo%' #LIKE is case insensitive by default
|
708
|
+
nCount = getAccount.find( :count,
|
709
|
+
:conditions => {
|
710
|
+
{:name=>'industry', :op=>'LIKE'} => query2}
|
711
|
+
)
|
712
|
+
|
713
|
+
nCount.should_not == 0
|
714
|
+
end
|
715
|
+
|
541
716
|
it "should find with group of advanced conditions" do
|
542
717
|
query = '%IND%'
|
543
718
|
cond1 = {
|
544
719
|
:conditions => {
|
545
|
-
{:
|
546
|
-
{:
|
720
|
+
{:name=>'name', :op=>'LIKE'} => query,
|
721
|
+
{:name=>'industry', :op=>'LIKE'} => query},
|
547
722
|
:op => 'OR'
|
548
723
|
}
|
549
724
|
cond2 = {
|
@@ -691,8 +866,6 @@ end
|
|
691
866
|
@accts[0].industry.should == "Technology"
|
692
867
|
end
|
693
868
|
|
694
|
-
if !defined? RHO_ME
|
695
|
-
|
696
869
|
it "should support sql conditions arg" do
|
697
870
|
@accts = getAccount.find(:all, :conditions => "name = 'Mobio India'")
|
698
871
|
@accts.length.should == 1
|
@@ -700,6 +873,13 @@ if !defined? RHO_ME
|
|
700
873
|
@accts[0].industry.should == "Technology"
|
701
874
|
end
|
702
875
|
|
876
|
+
it "should support simple sql conditions" do
|
877
|
+
@accts = getAccount.find(:all, :conditions => ["name = ?", "'Mobio India'"])
|
878
|
+
@accts.length.should == 1
|
879
|
+
@accts[0].name.should == "Mobio India"
|
880
|
+
@accts[0].industry.should == "Technology"
|
881
|
+
end
|
882
|
+
|
703
883
|
it "should support complex sql conditions arg" do
|
704
884
|
@accts = getAccount.find(:all, :conditions => "name like 'Mobio%'")
|
705
885
|
@accts.length.should == 1
|
@@ -720,7 +900,6 @@ if !defined? RHO_ME
|
|
720
900
|
@accts[0].name.should == "Mobio India"
|
721
901
|
@accts[0].industry.should == "Technology"
|
722
902
|
end
|
723
|
-
end
|
724
903
|
|
725
904
|
end
|
726
905
|
|