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.
- data/Manifest.txt +159 -30
- data/Rakefile +3 -19
- data/lib/erb.rb +1 -1
- data/lib/rho/rho.rb +94 -107
- data/lib/rho/rhofsconnector.rb +4 -0
- data/lib/rho/rhoutils.rb +26 -0
- data/lib/rho/rhoviewhelpers.rb +1 -1
- data/lib/rhodes.rb +2 -2
- data/lib/rhoframework.rb +9 -9
- data/lib/rhom/rhom.rb +1 -1
- data/lib/rhom/rhom_db_adapter.rb +36 -15
- data/lib/rhom/rhom_db_adapterME.rb +2 -3
- data/lib/rhom/rhom_object.rb +14 -2
- data/lib/rhom/rhom_object_factory.rb +42 -11
- data/lib/version.rb +2 -2
- data/spec/README +1 -0
- data/spec/Rakefile +1 -0
- data/spec/{configs/account.rb → app/Account/config.rb} +0 -0
- data/spec/{configs/case.rb → app/Case/config.rb} +0 -0
- data/spec/app/Question/config.rb +3 -0
- data/spec/app/Settings/controller.rb +10 -0
- data/spec/app/Settings/index.erb +11 -0
- data/spec/app/SpecRunner/controller.rb +15 -0
- data/spec/app/SpecRunner/index.erb +14 -0
- data/spec/app/application.rb +4 -0
- data/spec/app/index.erb +17 -0
- data/spec/app/layout.erb +27 -0
- data/spec/app/loading.html +11 -0
- data/spec/app/mspec.rb +11 -0
- data/spec/app/mspec/expectations.rb +2 -0
- data/spec/app/mspec/expectations/expectations.rb +17 -0
- data/spec/app/mspec/expectations/should.rb +25 -0
- data/spec/app/mspec/fileutils.rb +1590 -0
- data/spec/app/mspec/guards.rb +16 -0
- data/spec/app/mspec/guards/background.rb +21 -0
- data/spec/app/mspec/guards/bug.rb +24 -0
- data/spec/app/mspec/guards/compliance.rb +37 -0
- data/spec/app/mspec/guards/conflict.rb +18 -0
- data/spec/app/mspec/guards/endian.rb +44 -0
- data/spec/app/mspec/guards/extensions.rb +20 -0
- data/spec/app/mspec/guards/guard.rb +166 -0
- data/spec/app/mspec/guards/noncompliance.rb +20 -0
- data/spec/app/mspec/guards/platform.rb +43 -0
- data/spec/app/mspec/guards/quarantine.rb +17 -0
- data/spec/app/mspec/guards/runner.rb +34 -0
- data/spec/app/mspec/guards/superuser.rb +17 -0
- data/spec/app/mspec/guards/support.rb +20 -0
- data/spec/app/mspec/guards/tty.rb +20 -0
- data/spec/app/mspec/guards/version.rb +38 -0
- data/spec/app/mspec/helpers.rb +11 -0
- data/spec/app/mspec/helpers/argv.rb +43 -0
- data/spec/app/mspec/helpers/bignum.rb +5 -0
- data/spec/app/mspec/helpers/const_lookup.rb +9 -0
- data/spec/app/mspec/helpers/environment.rb +23 -0
- data/spec/app/mspec/helpers/fixture.rb +20 -0
- data/spec/app/mspec/helpers/flunk.rb +5 -0
- data/spec/app/mspec/helpers/io.rb +17 -0
- data/spec/app/mspec/helpers/language_version.rb +20 -0
- data/spec/app/mspec/helpers/ruby_exe.rb +123 -0
- data/spec/app/mspec/helpers/scratch.rb +17 -0
- data/spec/app/mspec/helpers/tmp.rb +32 -0
- data/spec/app/mspec/matchers.rb +23 -0
- data/spec/app/mspec/matchers/base.rb +95 -0
- data/spec/app/mspec/matchers/be_an_instance_of.rb +26 -0
- data/spec/app/mspec/matchers/be_ancestor_of.rb +24 -0
- data/spec/app/mspec/matchers/be_close.rb +27 -0
- data/spec/app/mspec/matchers/be_empty.rb +20 -0
- data/spec/app/mspec/matchers/be_false.rb +20 -0
- data/spec/app/mspec/matchers/be_kind_of.rb +24 -0
- data/spec/app/mspec/matchers/be_nil.rb +20 -0
- data/spec/app/mspec/matchers/be_true.rb +20 -0
- data/spec/app/mspec/matchers/complain.rb +56 -0
- data/spec/app/mspec/matchers/eql.rb +26 -0
- data/spec/app/mspec/matchers/equal.rb +26 -0
- data/spec/app/mspec/matchers/equal_element.rb +78 -0
- data/spec/app/mspec/matchers/equal_utf16.rb +34 -0
- data/spec/app/mspec/matchers/have_constant.rb +30 -0
- data/spec/app/mspec/matchers/have_instance_method.rb +24 -0
- data/spec/app/mspec/matchers/have_method.rb +24 -0
- data/spec/app/mspec/matchers/have_private_instance_method.rb +24 -0
- data/spec/app/mspec/matchers/include.rb +32 -0
- data/spec/app/mspec/matchers/match_yaml.rb +47 -0
- data/spec/app/mspec/matchers/method.rb +14 -0
- data/spec/app/mspec/matchers/output.rb +67 -0
- data/spec/app/mspec/matchers/output_to_fd.rb +71 -0
- data/spec/app/mspec/matchers/raise_error.rb +48 -0
- data/spec/app/mspec/matchers/respond_to.rb +24 -0
- data/spec/app/mspec/matchers/stringsymboladapter.rb +8 -0
- data/spec/app/mspec/mocks.rb +3 -0
- data/spec/app/mspec/mocks/mock.rb +159 -0
- data/spec/app/mspec/mocks/object.rb +20 -0
- data/spec/app/mspec/mocks/proxy.rb +136 -0
- data/spec/app/mspec/pp.rb +893 -0
- data/spec/app/mspec/runner.rb +15 -0
- data/spec/app/mspec/runner/actions.rb +8 -0
- data/spec/app/mspec/runner/actions/debug.rb +17 -0
- data/spec/app/mspec/runner/actions/filter.rb +40 -0
- data/spec/app/mspec/runner/actions/gdb.rb +17 -0
- data/spec/app/mspec/runner/actions/tag.rb +133 -0
- data/spec/app/mspec/runner/actions/taglist.rb +56 -0
- data/spec/app/mspec/runner/actions/tagpurge.rb +56 -0
- data/spec/app/mspec/runner/actions/tally.rb +116 -0
- data/spec/app/mspec/runner/actions/timer.rb +22 -0
- data/spec/app/mspec/runner/context.rb +188 -0
- data/spec/app/mspec/runner/example.rb +34 -0
- data/spec/app/mspec/runner/exception.rb +43 -0
- data/spec/app/mspec/runner/filters.rb +4 -0
- data/spec/app/mspec/runner/filters/match.rb +22 -0
- data/spec/app/mspec/runner/filters/profile.rb +54 -0
- data/spec/app/mspec/runner/filters/regexp.rb +7 -0
- data/spec/app/mspec/runner/filters/tag.rb +29 -0
- data/spec/app/mspec/runner/formatters.rb +10 -0
- data/spec/app/mspec/runner/formatters/describe.rb +24 -0
- data/spec/app/mspec/runner/formatters/dotted.rb +98 -0
- data/spec/app/mspec/runner/formatters/file.rb +19 -0
- data/spec/app/mspec/runner/formatters/html.rb +81 -0
- data/spec/app/mspec/runner/formatters/method.rb +93 -0
- data/spec/app/mspec/runner/formatters/specdoc.rb +41 -0
- data/spec/app/mspec/runner/formatters/spinner.rb +99 -0
- data/spec/app/mspec/runner/formatters/summary.rb +11 -0
- data/spec/app/mspec/runner/formatters/unit.rb +21 -0
- data/spec/app/mspec/runner/formatters/yaml.rb +44 -0
- data/spec/app/mspec/runner/mspec.rb +361 -0
- data/spec/app/mspec/runner/object.rb +24 -0
- data/spec/app/mspec/runner/shared.rb +12 -0
- data/spec/app/mspec/runner/tag.rb +32 -0
- data/spec/app/mspec/utils/name_map.rb +129 -0
- data/spec/app/mspec/utils/options.rb +441 -0
- data/spec/app/mspec/utils/ruby_name.rb +8 -0
- data/spec/app/mspec/utils/script.rb +220 -0
- data/spec/app/mspec/utils/version.rb +53 -0
- data/spec/app/mspec/version.rb +5 -0
- data/spec/app/spec/fixtures/client_info.txt +2 -0
- data/spec/app/spec/fixtures/object_values.txt +90 -0
- data/spec/{rho_controller_spec.rb → app/spec/rho_controller_spec.rb} +4 -7
- data/spec/{rho_spec.rb → app/spec/rho_spec.rb} +15 -36
- data/spec/{rhom_object_factory_spec.rb → app/spec/rhom_object_factory_spec.rb} +108 -72
- data/spec/{rhom_spec.rb → app/spec/rhom_spec.rb} +8 -4
- data/spec/app/spec/spec_helper.rb +15 -0
- data/spec/app/spec/webview_spec.rb +27 -0
- data/spec/app/spec_runner.rb +26 -0
- data/spec/build.yml +28 -0
- data/spec/public/css/base.css +39 -0
- data/spec/public/css/blackberry.css +99 -0
- data/spec/public/css/iphone.css +392 -0
- data/spec/public/css/rho.css +3 -0
- data/spec/public/css/xhtml.css +114 -0
- data/spec/public/images/IUI_LICENSE.txt +21 -0
- data/spec/public/images/backButton.png +0 -0
- data/spec/public/images/blueButton.png +0 -0
- data/spec/public/images/cancel.png +0 -0
- data/spec/public/images/grayButton.png +0 -0
- data/spec/public/images/iui-logo-touch-icon.png +0 -0
- data/spec/public/images/listArrow.png +0 -0
- data/spec/public/images/listArrowSel.png +0 -0
- data/spec/public/images/listGroup.png +0 -0
- data/spec/public/images/loading.gif +0 -0
- data/spec/public/images/pinstripes.png +0 -0
- data/spec/public/images/right_button.png +0 -0
- data/spec/public/images/selection.png +0 -0
- data/spec/public/images/thumb.png +0 -0
- data/spec/public/images/toggle.png +0 -0
- data/spec/public/images/toggleOn.png +0 -0
- data/spec/public/images/toolButton.png +0 -0
- data/spec/public/images/toolButton_new.png +0 -0
- data/spec/public/images/toolbar.png +0 -0
- data/spec/public/images/whiteButton.png +0 -0
- data/spec/public/js/application.js +1 -0
- data/spec/public/js/jquery-1.2.6.min.js +32 -0
- data/spec/public/js/rho.js +4 -0
- data/spec/public/js/rhogeolocation-wm.js +59 -0
- data/spec/public/js/rhogeolocation.js +11 -0
- data/spec/rhoconfig.txt +19 -0
- metadata +169 -39
- data/History.txt +0 -37
- data/README.rdoc +0 -2
- data/lib/TestServe.rb +0 -9
- data/res/sqlite3/constants.rb +0 -49
- data/res/sqlite3/database.rb +0 -715
- data/res/sqlite3/driver/dl/api.rb +0 -154
- data/res/sqlite3/driver/dl/driver.rb +0 -307
- data/res/sqlite3/driver/native/driver.rb +0 -257
- data/res/sqlite3/errors.rb +0 -68
- data/res/sqlite3/pragmas.rb +0 -271
- data/res/sqlite3/resultset.rb +0 -176
- data/res/sqlite3/sqlite3_api.rb +0 -0
- data/res/sqlite3/statement.rb +0 -230
- data/res/sqlite3/translator.rb +0 -109
- data/res/sqlite3/value.rb +0 -57
- data/res/sqlite3/version.rb +0 -14
- data/rhodes.gemspec +0 -18
- data/spec/app_manifest.txt +0 -4
- data/spec/configs/contact.rb +0 -3
- data/spec/configs/employee.rb +0 -3
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -49
- data/spec/stubs.rb +0 -39
- 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
|
19
|
+
require 'spec/spec_helper'
|
20
20
|
|
21
|
-
describe "RhomObjectFactory" do
|
22
|
-
|
23
|
-
it_should_behave_like "
|
24
|
-
|
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 ==
|
47
|
-
results[0].case_number.should == "
|
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 ==
|
54
|
-
results[0].name.should == "
|
55
|
-
results[0].industry.should == "
|
56
|
-
results[1].name.should == "
|
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 ==
|
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 ==
|
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(
|
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(
|
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"=>"
|
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
|
-
|
313
|
+
Question.ask(question)
|
282
314
|
|
283
|
-
@
|
284
|
-
@
|
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' =>
|
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' =>
|
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
|
-
|
332
|
+
Question.ask(question)
|
301
333
|
|
302
|
-
@
|
303
|
-
@
|
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' =>
|
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 ==
|
314
|
-
@accts[0].name.should == "
|
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 == "
|
332
|
-
@accts[1].industry.should == "
|
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 => '
|
339
|
-
@accts.length.should ==
|
340
|
-
@accts.
|
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' => '
|
380
|
+
Account.delete_all(:conditions => {'name' => 'Mobio India'})
|
367
381
|
|
368
|
-
@accts = Account.find(:all, :conditions => {'name' => '
|
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 ==
|
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
|
-
|
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 "
|
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
|
+
|