rhodes-framework 1.0.10 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. data/Manifest.txt +159 -30
  2. data/Rakefile +3 -19
  3. data/lib/erb.rb +1 -1
  4. data/lib/rho/rho.rb +94 -107
  5. data/lib/rho/rhofsconnector.rb +4 -0
  6. data/lib/rho/rhoutils.rb +26 -0
  7. data/lib/rho/rhoviewhelpers.rb +1 -1
  8. data/lib/rhodes.rb +2 -2
  9. data/lib/rhoframework.rb +9 -9
  10. data/lib/rhom/rhom.rb +1 -1
  11. data/lib/rhom/rhom_db_adapter.rb +36 -15
  12. data/lib/rhom/rhom_db_adapterME.rb +2 -3
  13. data/lib/rhom/rhom_object.rb +14 -2
  14. data/lib/rhom/rhom_object_factory.rb +42 -11
  15. data/lib/version.rb +2 -2
  16. data/spec/README +1 -0
  17. data/spec/Rakefile +1 -0
  18. data/spec/{configs/account.rb → app/Account/config.rb} +0 -0
  19. data/spec/{configs/case.rb → app/Case/config.rb} +0 -0
  20. data/spec/app/Question/config.rb +3 -0
  21. data/spec/app/Settings/controller.rb +10 -0
  22. data/spec/app/Settings/index.erb +11 -0
  23. data/spec/app/SpecRunner/controller.rb +15 -0
  24. data/spec/app/SpecRunner/index.erb +14 -0
  25. data/spec/app/application.rb +4 -0
  26. data/spec/app/index.erb +17 -0
  27. data/spec/app/layout.erb +27 -0
  28. data/spec/app/loading.html +11 -0
  29. data/spec/app/mspec.rb +11 -0
  30. data/spec/app/mspec/expectations.rb +2 -0
  31. data/spec/app/mspec/expectations/expectations.rb +17 -0
  32. data/spec/app/mspec/expectations/should.rb +25 -0
  33. data/spec/app/mspec/fileutils.rb +1590 -0
  34. data/spec/app/mspec/guards.rb +16 -0
  35. data/spec/app/mspec/guards/background.rb +21 -0
  36. data/spec/app/mspec/guards/bug.rb +24 -0
  37. data/spec/app/mspec/guards/compliance.rb +37 -0
  38. data/spec/app/mspec/guards/conflict.rb +18 -0
  39. data/spec/app/mspec/guards/endian.rb +44 -0
  40. data/spec/app/mspec/guards/extensions.rb +20 -0
  41. data/spec/app/mspec/guards/guard.rb +166 -0
  42. data/spec/app/mspec/guards/noncompliance.rb +20 -0
  43. data/spec/app/mspec/guards/platform.rb +43 -0
  44. data/spec/app/mspec/guards/quarantine.rb +17 -0
  45. data/spec/app/mspec/guards/runner.rb +34 -0
  46. data/spec/app/mspec/guards/superuser.rb +17 -0
  47. data/spec/app/mspec/guards/support.rb +20 -0
  48. data/spec/app/mspec/guards/tty.rb +20 -0
  49. data/spec/app/mspec/guards/version.rb +38 -0
  50. data/spec/app/mspec/helpers.rb +11 -0
  51. data/spec/app/mspec/helpers/argv.rb +43 -0
  52. data/spec/app/mspec/helpers/bignum.rb +5 -0
  53. data/spec/app/mspec/helpers/const_lookup.rb +9 -0
  54. data/spec/app/mspec/helpers/environment.rb +23 -0
  55. data/spec/app/mspec/helpers/fixture.rb +20 -0
  56. data/spec/app/mspec/helpers/flunk.rb +5 -0
  57. data/spec/app/mspec/helpers/io.rb +17 -0
  58. data/spec/app/mspec/helpers/language_version.rb +20 -0
  59. data/spec/app/mspec/helpers/ruby_exe.rb +123 -0
  60. data/spec/app/mspec/helpers/scratch.rb +17 -0
  61. data/spec/app/mspec/helpers/tmp.rb +32 -0
  62. data/spec/app/mspec/matchers.rb +23 -0
  63. data/spec/app/mspec/matchers/base.rb +95 -0
  64. data/spec/app/mspec/matchers/be_an_instance_of.rb +26 -0
  65. data/spec/app/mspec/matchers/be_ancestor_of.rb +24 -0
  66. data/spec/app/mspec/matchers/be_close.rb +27 -0
  67. data/spec/app/mspec/matchers/be_empty.rb +20 -0
  68. data/spec/app/mspec/matchers/be_false.rb +20 -0
  69. data/spec/app/mspec/matchers/be_kind_of.rb +24 -0
  70. data/spec/app/mspec/matchers/be_nil.rb +20 -0
  71. data/spec/app/mspec/matchers/be_true.rb +20 -0
  72. data/spec/app/mspec/matchers/complain.rb +56 -0
  73. data/spec/app/mspec/matchers/eql.rb +26 -0
  74. data/spec/app/mspec/matchers/equal.rb +26 -0
  75. data/spec/app/mspec/matchers/equal_element.rb +78 -0
  76. data/spec/app/mspec/matchers/equal_utf16.rb +34 -0
  77. data/spec/app/mspec/matchers/have_constant.rb +30 -0
  78. data/spec/app/mspec/matchers/have_instance_method.rb +24 -0
  79. data/spec/app/mspec/matchers/have_method.rb +24 -0
  80. data/spec/app/mspec/matchers/have_private_instance_method.rb +24 -0
  81. data/spec/app/mspec/matchers/include.rb +32 -0
  82. data/spec/app/mspec/matchers/match_yaml.rb +47 -0
  83. data/spec/app/mspec/matchers/method.rb +14 -0
  84. data/spec/app/mspec/matchers/output.rb +67 -0
  85. data/spec/app/mspec/matchers/output_to_fd.rb +71 -0
  86. data/spec/app/mspec/matchers/raise_error.rb +48 -0
  87. data/spec/app/mspec/matchers/respond_to.rb +24 -0
  88. data/spec/app/mspec/matchers/stringsymboladapter.rb +8 -0
  89. data/spec/app/mspec/mocks.rb +3 -0
  90. data/spec/app/mspec/mocks/mock.rb +159 -0
  91. data/spec/app/mspec/mocks/object.rb +20 -0
  92. data/spec/app/mspec/mocks/proxy.rb +136 -0
  93. data/spec/app/mspec/pp.rb +893 -0
  94. data/spec/app/mspec/runner.rb +15 -0
  95. data/spec/app/mspec/runner/actions.rb +8 -0
  96. data/spec/app/mspec/runner/actions/debug.rb +17 -0
  97. data/spec/app/mspec/runner/actions/filter.rb +40 -0
  98. data/spec/app/mspec/runner/actions/gdb.rb +17 -0
  99. data/spec/app/mspec/runner/actions/tag.rb +133 -0
  100. data/spec/app/mspec/runner/actions/taglist.rb +56 -0
  101. data/spec/app/mspec/runner/actions/tagpurge.rb +56 -0
  102. data/spec/app/mspec/runner/actions/tally.rb +116 -0
  103. data/spec/app/mspec/runner/actions/timer.rb +22 -0
  104. data/spec/app/mspec/runner/context.rb +188 -0
  105. data/spec/app/mspec/runner/example.rb +34 -0
  106. data/spec/app/mspec/runner/exception.rb +43 -0
  107. data/spec/app/mspec/runner/filters.rb +4 -0
  108. data/spec/app/mspec/runner/filters/match.rb +22 -0
  109. data/spec/app/mspec/runner/filters/profile.rb +54 -0
  110. data/spec/app/mspec/runner/filters/regexp.rb +7 -0
  111. data/spec/app/mspec/runner/filters/tag.rb +29 -0
  112. data/spec/app/mspec/runner/formatters.rb +10 -0
  113. data/spec/app/mspec/runner/formatters/describe.rb +24 -0
  114. data/spec/app/mspec/runner/formatters/dotted.rb +98 -0
  115. data/spec/app/mspec/runner/formatters/file.rb +19 -0
  116. data/spec/app/mspec/runner/formatters/html.rb +81 -0
  117. data/spec/app/mspec/runner/formatters/method.rb +93 -0
  118. data/spec/app/mspec/runner/formatters/specdoc.rb +41 -0
  119. data/spec/app/mspec/runner/formatters/spinner.rb +99 -0
  120. data/spec/app/mspec/runner/formatters/summary.rb +11 -0
  121. data/spec/app/mspec/runner/formatters/unit.rb +21 -0
  122. data/spec/app/mspec/runner/formatters/yaml.rb +44 -0
  123. data/spec/app/mspec/runner/mspec.rb +361 -0
  124. data/spec/app/mspec/runner/object.rb +24 -0
  125. data/spec/app/mspec/runner/shared.rb +12 -0
  126. data/spec/app/mspec/runner/tag.rb +32 -0
  127. data/spec/app/mspec/utils/name_map.rb +129 -0
  128. data/spec/app/mspec/utils/options.rb +441 -0
  129. data/spec/app/mspec/utils/ruby_name.rb +8 -0
  130. data/spec/app/mspec/utils/script.rb +220 -0
  131. data/spec/app/mspec/utils/version.rb +53 -0
  132. data/spec/app/mspec/version.rb +5 -0
  133. data/spec/app/spec/fixtures/client_info.txt +2 -0
  134. data/spec/app/spec/fixtures/object_values.txt +90 -0
  135. data/spec/{rho_controller_spec.rb → app/spec/rho_controller_spec.rb} +4 -7
  136. data/spec/{rho_spec.rb → app/spec/rho_spec.rb} +15 -36
  137. data/spec/{rhom_object_factory_spec.rb → app/spec/rhom_object_factory_spec.rb} +108 -72
  138. data/spec/{rhom_spec.rb → app/spec/rhom_spec.rb} +8 -4
  139. data/spec/app/spec/spec_helper.rb +15 -0
  140. data/spec/app/spec/webview_spec.rb +27 -0
  141. data/spec/app/spec_runner.rb +26 -0
  142. data/spec/build.yml +28 -0
  143. data/spec/public/css/base.css +39 -0
  144. data/spec/public/css/blackberry.css +99 -0
  145. data/spec/public/css/iphone.css +392 -0
  146. data/spec/public/css/rho.css +3 -0
  147. data/spec/public/css/xhtml.css +114 -0
  148. data/spec/public/images/IUI_LICENSE.txt +21 -0
  149. data/spec/public/images/backButton.png +0 -0
  150. data/spec/public/images/blueButton.png +0 -0
  151. data/spec/public/images/cancel.png +0 -0
  152. data/spec/public/images/grayButton.png +0 -0
  153. data/spec/public/images/iui-logo-touch-icon.png +0 -0
  154. data/spec/public/images/listArrow.png +0 -0
  155. data/spec/public/images/listArrowSel.png +0 -0
  156. data/spec/public/images/listGroup.png +0 -0
  157. data/spec/public/images/loading.gif +0 -0
  158. data/spec/public/images/pinstripes.png +0 -0
  159. data/spec/public/images/right_button.png +0 -0
  160. data/spec/public/images/selection.png +0 -0
  161. data/spec/public/images/thumb.png +0 -0
  162. data/spec/public/images/toggle.png +0 -0
  163. data/spec/public/images/toggleOn.png +0 -0
  164. data/spec/public/images/toolButton.png +0 -0
  165. data/spec/public/images/toolButton_new.png +0 -0
  166. data/spec/public/images/toolbar.png +0 -0
  167. data/spec/public/images/whiteButton.png +0 -0
  168. data/spec/public/js/application.js +1 -0
  169. data/spec/public/js/jquery-1.2.6.min.js +32 -0
  170. data/spec/public/js/rho.js +4 -0
  171. data/spec/public/js/rhogeolocation-wm.js +59 -0
  172. data/spec/public/js/rhogeolocation.js +11 -0
  173. data/spec/rhoconfig.txt +19 -0
  174. metadata +169 -39
  175. data/History.txt +0 -37
  176. data/README.rdoc +0 -2
  177. data/lib/TestServe.rb +0 -9
  178. data/res/sqlite3/constants.rb +0 -49
  179. data/res/sqlite3/database.rb +0 -715
  180. data/res/sqlite3/driver/dl/api.rb +0 -154
  181. data/res/sqlite3/driver/dl/driver.rb +0 -307
  182. data/res/sqlite3/driver/native/driver.rb +0 -257
  183. data/res/sqlite3/errors.rb +0 -68
  184. data/res/sqlite3/pragmas.rb +0 -271
  185. data/res/sqlite3/resultset.rb +0 -176
  186. data/res/sqlite3/sqlite3_api.rb +0 -0
  187. data/res/sqlite3/statement.rb +0 -230
  188. data/res/sqlite3/translator.rb +0 -109
  189. data/res/sqlite3/value.rb +0 -57
  190. data/res/sqlite3/version.rb +0 -14
  191. data/rhodes.gemspec +0 -18
  192. data/spec/app_manifest.txt +0 -4
  193. data/spec/configs/contact.rb +0 -3
  194. data/spec/configs/employee.rb +0 -3
  195. data/spec/spec.opts +0 -1
  196. data/spec/spec_helper.rb +0 -49
  197. data/spec/stubs.rb +0 -39
  198. data/spec/syncdbtest.sqlite +0 -0
@@ -16,19 +16,21 @@
16
16
  # You should have received a copy of the GNU General Public License
17
17
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
18
  #
19
- require File.dirname(__FILE__) + "/spec_helper"
19
+ require 'spec/spec_helper'
20
20
 
21
- describe "RhomObjectFactory" do
22
-
23
- it_should_behave_like "rho initializer"
24
- it_should_behave_like "rho db initializer"
21
+ describe "Rhom::RhomObjectFactory" do
22
+
23
+ it_should_behave_like "rhom initializer"
24
+
25
+ before do
26
+ SyncEngine.stub!(:dosync).and_return(true)
27
+ end
25
28
 
26
29
  it "should set source_id attributes" do
27
30
  Account.get_source_id.should == "1"
28
31
  Case.get_source_id.should == "2"
29
- Employee.get_source_id.should == "3"
30
32
  end
31
-
33
+
32
34
  it "should dynamically assign values" do
33
35
  account = Account.new
34
36
  account.name = 'hello name'
@@ -43,52 +45,68 @@ describe "RhomObjectFactory" do
43
45
 
44
46
  it "should retrieve Case models" do
45
47
  results = Case.find(:all)
46
- results.length.should == 7
47
- results[0].case_number.should == "57"
48
- results[4].name.should == "implement SugarCRM sample app"
48
+ results.length.should == 1
49
+ results[0].case_number.should == "58"
49
50
  end
50
51
 
51
52
  it "should retrieve Account models" do
52
53
  results = Account.find(:all)
53
- results.length.should == 5
54
- results[0].name.should == "vSpring"
55
- results[0].industry.should == "Finance"
56
- results[1].name.should == "Rhomobile"
54
+ results.length.should == 2
55
+ results[0].name.should == "Mobio India"
56
+ results[0].industry.should == "Technology"
57
+ results[1].name.should == "Aeroprise"
57
58
  results[1].industry.should == "Technology"
58
- results[4].industry.should == "Technology"
59
- results[4].name.should == "Mobio India"
60
59
  end
61
60
 
62
61
  it "should have correct number of attributes" do
63
62
  @account = Account.find(:all).first
64
-
65
- @account.instance_variables.size.should == 37
63
+
64
+ @account.instance_variables.size.should == 36
66
65
  end
67
66
 
68
67
  it "should get count of objects" do
69
- Account.count.should == 5
68
+ Account.count.should == 2
70
69
  end
71
70
 
71
+ # it "should raise RecordNotFound error if nil given as find argument" do
72
+ # lambda {
73
+ # get 'index'
74
+ # }.should_raise(Rhom::RecordNotFound)
75
+ # end
76
+
72
77
  it "should create multiple records offline" do
73
78
  vars = {"name"=>"foobarthree", "industry"=>"entertainment"}
74
79
  account = Account.new(vars)
80
+ obj = account.object
75
81
  account.save
76
- acct = Account.find(:first, :conditions =>{'name'=>'foobarthree'})
82
+ acct = Account.find(obj)
77
83
  acct.name.should == 'foobarthree'
78
84
  acct.industry.should == 'entertainment'
79
85
 
80
86
  account = Account.new
87
+ obj = account.object
81
88
  account.name = 'foobarfour'
82
89
  account.industry = 'solar'
83
90
  account.save
84
91
 
85
- acct = Account.find(:first, :conditions =>{'name'=>'foobarfour'})
92
+ acct = Account.find(obj)
86
93
  acct.name.should == 'foobarfour'
87
94
  acct.industry.should == 'solar'
88
95
  end
89
96
 
90
97
  it "should create a record" do
91
- vars = {"name"=>"some new record", "industry"=>"electronices"}
98
+ vars = {"name"=>"some new record", "industry"=>"electronics"}
99
+ @account1 = Account.new(vars)
100
+ new_id = @account1.object
101
+ @account1.save
102
+ @account2 = Account.find(new_id)
103
+ @account2.object.should =="{#{@account1.object}}"
104
+ @account2.name.should == vars['name']
105
+ @account2.industry.should == vars['industry']
106
+ end
107
+
108
+ it "should create multiple records" do
109
+ vars = {"name"=>"some new record", "industry"=>"electronics"}
92
110
  @account1 = Account.new(vars)
93
111
  new_id = @account1.object
94
112
  @account1.save
@@ -98,6 +116,20 @@ describe "RhomObjectFactory" do
98
116
  @account2.industry.should == vars['industry']
99
117
  end
100
118
 
119
+ it "should create multiple records with unique ids" do
120
+ ids = []
121
+ 10.times do |i|
122
+ vars = {"name"=>"some new record#{rand.to_s}", "industry"=>"electronics#{rand.to_s}"}
123
+ @acct = Account.new(vars)
124
+ ids << @acct.object
125
+ @acct.save
126
+ @acct = Account.find(ids[i])
127
+ @acct.name.should == vars['name']
128
+ @acct.industry.should == vars['industry']
129
+ end
130
+ ids.uniq.length.should == 10
131
+ end
132
+
101
133
  it "should destroy a record" do
102
134
  count = Account.find(:all).size
103
135
  @account = Account.find(:all)[0]
@@ -117,7 +149,7 @@ describe "RhomObjectFactory" do
117
149
  @new_acct.name.should == "Mobio US"
118
150
  @new_acct.industry.should == "Technology"
119
151
  end
120
-
152
+
121
153
  it "should fully update a record" do
122
154
  new_attributes = {"name"=>"Mobio US", "industry"=>"Electronics"}
123
155
  @account = Account.find(:all).first
@@ -136,9 +168,9 @@ describe "RhomObjectFactory" do
136
168
  "acct_object"=>"same object"}
137
169
  @account = Account.find('44e804f2-4933-4e20-271c-48fcecd9450d')
138
170
  @account.update_attributes(new_attributes)
139
-
171
+
140
172
  @new_acct = Account.find('44e804f2-4933-4e20-271c-48fcecd9450d')
141
-
173
+
142
174
  @new_acct.name.should == "Mobio India"
143
175
  @new_acct.account_type.should == "Partner"
144
176
  @new_acct.type_acct.should == "Customer"
@@ -150,12 +182,12 @@ describe "RhomObjectFactory" do
150
182
  new_attributes = {"type"=>"Partner"}
151
183
  @account = Account.find('44e804f2-4933-4e20-271c-48fcecd9450d')
152
184
  @account.update_attributes(new_attributes)
153
-
185
+
154
186
  @new_acct = Account.find('44e804f2-4933-4e20-271c-48fcecd9450d')
155
-
187
+
156
188
  @new_acct.name.should == "Mobio India"
157
189
  @new_acct.instance_variables.each do |var|
158
- var.gsub(/@/,'').match('\btype\b').should be_nil
190
+ var.to_s.gsub(/@/,'').match('\btype\b').should be_nil
159
191
  end
160
192
  end
161
193
 
@@ -177,7 +209,7 @@ describe "RhomObjectFactory" do
177
209
  @account.update_attributes(new_attributes)
178
210
 
179
211
  @new_acct = Account.find('44e804f2-4933-4e20-271c-48fcecd9450d')
180
-
212
+
181
213
  @new_acct.name.should be_nil
182
214
  @new_acct.industry.should == "Technology"
183
215
  end
@@ -188,7 +220,7 @@ describe "RhomObjectFactory" do
188
220
  @account.update_attributes(new_attributes)
189
221
 
190
222
  @new_acct = Account.find('44e804f2-4933-4e20-271c-48fcecd9450d')
191
-
223
+
192
224
  @new_acct.name.should == ""
193
225
  @new_acct.industry.should == "Technology"
194
226
  end
@@ -217,7 +249,7 @@ describe "RhomObjectFactory" do
217
249
  records = Rhom::RhomDbAdapter::select_from_table('object_values','*', 'update_type' => 'update')
218
250
  records.length.should == 1
219
251
  end
220
-
252
+
221
253
  it "should retrieve and modify one record" do
222
254
  @acct = Account.find('44e804f2-4933-4e20-271c-48fcecd9450d')
223
255
 
@@ -278,18 +310,18 @@ describe "RhomObjectFactory" do
278
310
  it "should store all ask db operations as query" do
279
311
  question = 'where am i?'
280
312
  question_encoded = 'where%20am%20i%3F'
281
- Contact.ask(question)
313
+ Question.ask(question)
282
314
 
283
- @contact = Contact.find(:first)
284
- @contact.update_attributes({"question"=>"i am here"})
315
+ @question = Question.find(:first)
316
+ @question.update_attributes({"question"=>"i am here"})
285
317
 
286
- @res = Rhom::RhomDbAdapter::select_from_table('object_values','*', {'update_type' => 'query', 'source_id' => 350})
318
+ @res = Rhom::RhomDbAdapter::select_from_table('object_values','*', {'update_type' => 'query', 'source_id' => 400})
287
319
  @res.length.should == 1
288
320
  @res[0]['attrib'].should == 'question'
289
321
  @res[0]['value'].should == 'i am here'
290
322
 
291
323
  ['create','update','delete'].each do |u_type|
292
- @res = Rhom::RhomDbAdapter::select_from_table('object_values','*', {'update_type' =>u_type, 'source_id' => 350})
324
+ @res = Rhom::RhomDbAdapter::select_from_table('object_values','*', {'update_type' =>u_type, 'source_id' => 400})
293
325
  @res.length.should == 0
294
326
  end
295
327
  end
@@ -297,21 +329,21 @@ describe "RhomObjectFactory" do
297
329
  it "should delete ask records without delete sync operation" do
298
330
  question = 'where am i?'
299
331
  question_encoded = 'where%20am%20i%3F'
300
- Contact.ask(question)
332
+ Question.ask(question)
301
333
 
302
- @contact = Contact.find(:first)
303
- @contact.destroy
334
+ @question = Question.find(:first)
335
+ @question.destroy
304
336
 
305
337
  ['query','create','update','delete'].each do |u_type|
306
- @res = Rhom::RhomDbAdapter::select_from_table('object_values','*', {'update_type' =>u_type, 'source_id' => 350})
338
+ @res = Rhom::RhomDbAdapter::select_from_table('object_values','*', {'update_type' =>u_type, 'source_id' => 400})
307
339
  @res.length.should == 0
308
340
  end
309
341
  end
310
342
 
311
343
  it "should find with conditions" do
312
344
  @accts = Account.find(:all, :conditions => {'industry' => 'Technology'})
313
- @accts.length.should == 3
314
- @accts[0].name.should == "Rhomobile"
345
+ @accts.length.should == 2
346
+ @accts[0].name.should == "Mobio India"
315
347
  @accts[0].industry.should == "Technology"
316
348
  @accts[1].name.should == "Aeroprise"
317
349
  @accts[1].industry.should == "Technology"
@@ -328,32 +360,14 @@ describe "RhomObjectFactory" do
328
360
 
329
361
  @accts.first.name.should == "Aeroprise"
330
362
  @accts.first.industry.should == "Technology"
331
- @accts[1].name.should == "Mirapath"
332
- @accts[1].industry.should == "Electronics"
333
- @accts.last.name.should == "vSpring"
334
- @accts.last.industry.should == "Finance"
363
+ @accts[1].name.should == "Mobio India"
364
+ @accts[1].industry.should == "Technology"
335
365
  end
336
366
 
337
367
  it "should return records when order by is nil for some records" do
338
- @accts = Account.find(:all, :order => 'billing_address_country')
339
- @accts.length.should == 5
340
- @accts.first.name.should == "vSpring"
341
- end
342
-
343
- it "should include only selected columns" do
344
- pending "need to implement"
345
- @accts = Account.find(:all, :select => ['name'])
346
-
347
- @accts[0].name.should == "vSpring"
348
- @accts[0].industry.should be_nil
349
- end
350
-
351
- it "should include selected columns and conditions" do
352
- pending "need to implement"
353
- @accts = Account.find(:all, :conditions => {'name' => 'vSpring'}, :select => ['name'])
354
-
355
- @accts[0].name.should == "vSpring"
356
- @accts[0].industry.should be_nil
368
+ @accts = Account.find(:all, :order => 'shipping_address_country')
369
+ @accts.length.should == 2
370
+ @accts[1].name.should == "Aeroprise"
357
371
  end
358
372
 
359
373
  it "should delete_all" do
@@ -363,9 +377,9 @@ describe "RhomObjectFactory" do
363
377
  end
364
378
 
365
379
  it "should delete_all with conditions" do
366
- Account.delete_all(:conditions => {'name' => 'Mirapath'})
380
+ Account.delete_all(:conditions => {'name' => 'Mobio India'})
367
381
 
368
- @accts = Account.find(:all, :conditions => {'name' => 'Mirapath'})
382
+ @accts = Account.find(:all, :conditions => {'name' => 'Mobio India'})
369
383
  @accts.length.should == 0
370
384
  end
371
385
 
@@ -377,11 +391,7 @@ describe "RhomObjectFactory" do
377
391
 
378
392
  @accts = Account.find(:all)
379
393
 
380
- @accts.length.should == 2
381
- @accts[0].name.should == "vSpring"
382
- @accts[0].industry.should == "Finance"
383
- @accts[1].name.should == "Mirapath"
384
- @accts[1].industry.should == "Electronics"
394
+ @accts.length.should == 0
385
395
  end
386
396
 
387
397
  it "should support blob file type" do
@@ -391,4 +401,30 @@ describe "RhomObjectFactory" do
391
401
  @res = Rhom::RhomDbAdapter::select_from_table('object_values','*', 'attrib_type' => "blob.file")
392
402
  @res.length.should == 1
393
403
  end
404
+
405
+ it "should include only selected column" do
406
+ @accts = Account.find(:all, :select => ['name'])
407
+
408
+ @accts[0].name.should == "Mobio India"
409
+ @accts[0].industry.should be_nil
410
+ @accts[0].instance_variables.length.should == 2
411
+ end
412
+
413
+ it "should include only selected columns" do
414
+ @accts = Account.find(:all, :select => ['name','industry'])
415
+
416
+ @accts[0].name.should == "Mobio India"
417
+ @accts[0].industry.should == "Technology"
418
+ @accts[0].shipping_address_street.should be_nil
419
+ @accts[0].instance_variables.length.should == 3
420
+ end
421
+
422
+ it "should include selected columns and conditions" do
423
+ @accts = Account.find(:all, :conditions => {'name' => 'Mobio India'}, :select => ['name','industry'])
424
+ @accts.length.should == 1
425
+ @accts[0].name.should == "Mobio India"
426
+ @accts[0].industry.should == "Technology"
427
+ @accts[0].shipping_address_street.should be_nil
428
+ @accts[0].instance_variables.length.should == 3
429
+ end
394
430
  end
@@ -17,13 +17,11 @@
17
17
  # You should have received a copy of the GNU General Public License
18
18
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
19
  #
20
- $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
21
- require File.dirname(__FILE__) + "/spec_helper"
20
+ require 'spec/spec_helper'
22
21
 
23
22
  describe "Rhom" do
24
23
 
25
- it_should_behave_like "rho initializer"
26
- it_should_behave_like "rho db initializer"
24
+ it_should_behave_like "rhom initializer"
27
25
 
28
26
  it "should get client_id" do
29
27
  Rhom::Rhom::client_id.should == '67320d31-e42e-4156-af91-5d9bd7175b08'
@@ -42,4 +40,10 @@ describe "Rhom" do
42
40
  Rhom::RhomDbAdapter::select_from_table('client_info','*').length.should == 0
43
41
  Rhom::Rhom::client_id.should be_nil
44
42
  end
43
+
44
+ it "should call select_from_table with select array" do
45
+ sel_arr = ['name','industry']
46
+ @res = Rhom::RhomDbAdapter::select_from_table(::Rhom::TABLE_NAME, '*', {'object' => '44e804f2-4933-4e20-271c-48fcecd9450d'}, nil, sel_arr)
47
+ @res.length.should == 2
48
+ end
45
49
  end
@@ -0,0 +1,15 @@
1
+ require 'rho/rho'
2
+ require 'rhom/rhom'
3
+ require 'rho/rhoutils'
4
+
5
+ describe "rhom initializer", :shared => true do
6
+ before(:each) do
7
+ Rho::RhoUtils.load_offline_data(['client_info','object_values'], 'spec')
8
+ end
9
+
10
+ after(:each) do
11
+ Rhom::RhomDbAdapter.delete_all_from_table('client_info')
12
+ Rhom::RhomDbAdapter.delete_all_from_table('object_values')
13
+ #Rhom::RhomDbAdapter.delete_all_from_table('sources')
14
+ end
15
+ end
@@ -0,0 +1,27 @@
1
+ #
2
+ # webview_spec.rb
3
+ # rhodes
4
+ #
5
+ # Copyright (C) 2008 Rhomobile, Inc. All rights reserved.
6
+ #
7
+ # This program is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # This program is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ #
20
+ require 'spec/spec_helper'
21
+
22
+ describe "WebView" do
23
+
24
+ it "should evaulate simple javascript" do
25
+ WebView.execute_js("1+1").should == "2"
26
+ end
27
+ end
@@ -0,0 +1,26 @@
1
+ require 'mspec'
2
+ require 'mspec/utils/script'
3
+ require 'mspec/version'
4
+
5
+ class SpecRunner < MSpecScript
6
+ def initialize
7
+ super
8
+ config[:files] = []
9
+
10
+ # turn on exception backtrace
11
+ MSpec.backtrace = true
12
+
13
+ Dir.entries(File.join(File.dirname(__FILE__),'spec')).each do |x|
14
+ x = nil if not x =~ /.iseq/
15
+ puts "Adding spec file: #{x}" if x
16
+ config[:files] << File.join(File.dirname(__FILE__),'spec',File.basename(x,'.iseq')) if x
17
+ end
18
+ end
19
+
20
+ def run
21
+ MSpec.register_files config[:files]
22
+
23
+ MSpec.process
24
+ MSpec.exit_code
25
+ end
26
+ end
data/spec/build.yml ADDED
@@ -0,0 +1,28 @@
1
+ env:
2
+ version: 1.0.0
3
+ vendor: rhomobile
4
+ bbver: 4.6
5
+ applog: rholog.txt
6
+ symbian:
7
+ certname: rhodes_cert.cer
8
+ certkey: rhodes_pid.key
9
+ certpwd: 1234
10
+ selfsignname: "CN=Anton OU=Development OR=RhoMobile CO=RU EM=anton@rhomobile.com"
11
+ selfsignpwd: "1234"
12
+ paths:
13
+ 4.6:
14
+ jde: C:/Program Files/Research In Motion/BlackBerry JDE 4.6.0
15
+ java: C:/Program Files/Java/jdk1.6.0_11/bin
16
+ mds: C:/Program Files/Research In Motion/BlackBerry JDE 4.6.0/MDS
17
+ sim: 9000
18
+ 4.2:
19
+ jde: C:/Program Files/Research In Motion/BlackBerry JDE 4.2.0
20
+ java: C:/Install/Java/jdk1.6.0_11/bin
21
+ mds: C:/Program Files/Research In Motion/BlackBerry Email and MDS Services Simulators 4.1.2/MDS
22
+ sim: 8100
23
+ cabwiz: C:/Program Files/Windows Mobile 6 SDK/Tools/CabWiz/cabwiz.exe
24
+ wmemu: C:/Program Files/Microsoft Device Emulator/1.0/dvcemumanager.exe
25
+ symbiantools: C:/PROGRA~1/COMMON~1/Symbian/Tools
26
+ symroot: C:/Symbian/9.2/S60_3rd_FP1
27
+
28
+