rhodes 0.2.6 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/Manifest.txt +1 -0
- data/lib/rhodes.rb +2 -2
- data/lib/rhom/rhom.rb +16 -4
- data/spec/rho_spec.rb +1 -0
- data/spec/rhom_object_factory_spec.rb +1 -9
- data/spec/rhom_spec.rb +45 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/stubs.rb +8 -0
- metadata +3 -2
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/lib/rhodes.rb
CHANGED
data/lib/rhom/rhom.rb
CHANGED
@@ -38,9 +38,21 @@ module Rhom
|
|
38
38
|
@factory = RhomObjectFactory.new
|
39
39
|
end
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
class << Rhom
|
42
|
+
def client_id
|
43
|
+
c_id = ::Rhom::RhomDbAdapter::select_from_table('client_info','client_id')[0]
|
44
|
+
c_id.nil? ? nil : c_id['client_id']
|
45
|
+
end
|
46
|
+
|
47
|
+
def database_full_reset
|
48
|
+
::Rhom::RhomDbAdapter::delete_all_from_table(TABLE_NAME)
|
49
|
+
::Rhom::RhomDbAdapter::delete_all_from_table('client_info')
|
50
|
+
end
|
51
|
+
|
52
|
+
def database_full_reset_and_logout
|
53
|
+
database_full_reset
|
54
|
+
SyncEngine::logout
|
55
|
+
end
|
56
|
+
end #class methods
|
45
57
|
end # Rhom
|
46
58
|
end # Rhom
|
data/spec/rho_spec.rb
CHANGED
@@ -23,6 +23,7 @@ require File.dirname(__FILE__) + "/spec_helper"
|
|
23
23
|
describe "Rho" do
|
24
24
|
|
25
25
|
it_should_behave_like "rho initializer"
|
26
|
+
it_should_behave_like "rho db initializer"
|
26
27
|
|
27
28
|
it "should populate configuration in sources table" do
|
28
29
|
sources = Rhom::RhomDbAdapter::select_from_table('sources','*')
|
@@ -21,15 +21,7 @@ require File.dirname(__FILE__) + "/spec_helper"
|
|
21
21
|
describe "RhomObjectFactory" do
|
22
22
|
|
23
23
|
it_should_behave_like "rho initializer"
|
24
|
-
|
25
|
-
before(:each) do
|
26
|
-
FileUtils.cp_r('spec/syncdbtest.sqlite','build/syncdbtest.sqlite')
|
27
|
-
end
|
28
|
-
|
29
|
-
after(:each) do
|
30
|
-
FileUtils.rm_rf('build/syncdbtest.sqlite')
|
31
|
-
@rhom = nil
|
32
|
-
end
|
24
|
+
it_should_behave_like "rho db initializer"
|
33
25
|
|
34
26
|
it "should set source_id attributes" do
|
35
27
|
Account.get_source_id.should == "1"
|
data/spec/rhom_spec.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
#
|
2
|
+
# rhom_spec.rb
|
3
|
+
# rhodes
|
4
|
+
#
|
5
|
+
# Copyright (C) 2008 Lars Burgess. 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
|
+
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
21
|
+
require File.dirname(__FILE__) + "/spec_helper"
|
22
|
+
|
23
|
+
describe "Rhom" do
|
24
|
+
|
25
|
+
it_should_behave_like "rho initializer"
|
26
|
+
it_should_behave_like "rho db initializer"
|
27
|
+
|
28
|
+
it "should get client_id" do
|
29
|
+
Rhom::Rhom::client_id.should == '67320d31-e42e-4156-af91-5d9bd7175b08'
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should perform full reset of database" do
|
33
|
+
Rhom::Rhom::database_full_reset
|
34
|
+
Rhom::RhomDbAdapter::select_from_table('object_values','*').length.should == 0
|
35
|
+
Rhom::RhomDbAdapter::select_from_table('client_info','*').length.should == 0
|
36
|
+
Rhom::Rhom::client_id.should be_nil
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should perform full database reset and logout" do
|
40
|
+
Rhom::Rhom::database_full_reset_and_logout
|
41
|
+
Rhom::RhomDbAdapter::select_from_table('object_values','*').length.should == 0
|
42
|
+
Rhom::RhomDbAdapter::select_from_table('client_info','*').length.should == 0
|
43
|
+
Rhom::Rhom::client_id.should be_nil
|
44
|
+
end
|
45
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -34,4 +34,15 @@ describe "rho initializer", :shared => true do
|
|
34
34
|
puts "arr[#{i}] = #{x.inspect}"
|
35
35
|
end
|
36
36
|
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "rho db initializer", :shared => true do
|
40
|
+
before(:each) do
|
41
|
+
FileUtils.cp_r('spec/syncdbtest.sqlite','build/syncdbtest.sqlite')
|
42
|
+
end
|
43
|
+
|
44
|
+
after(:each) do
|
45
|
+
FileUtils.rm_rf('build/syncdbtest.sqlite')
|
46
|
+
@rhom = nil
|
47
|
+
end
|
37
48
|
end
|
data/spec/stubs.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhodes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rhomobile Dev
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-02-05 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -175,6 +175,7 @@ files:
|
|
175
175
|
- spec/rho_controller_spec.rb
|
176
176
|
- spec/rho_spec.rb
|
177
177
|
- spec/rhom_object_factory_spec.rb
|
178
|
+
- spec/rhom_spec.rb
|
178
179
|
- spec/source_generator_spec.rb
|
179
180
|
- spec/spec.opts
|
180
181
|
- spec/spec_helper.rb
|