rhodes 0.2.6 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.3.0 2009-02-05
2
+ * initial 0.3 release
3
+
1
4
  == 0.2.6 2009-01-29
2
5
  * changed signature of url_for, link_to, and redirect
3
6
 
data/Manifest.txt CHANGED
@@ -58,6 +58,7 @@ spec/model_generator_spec.rb
58
58
  spec/rho_controller_spec.rb
59
59
  spec/rho_spec.rb
60
60
  spec/rhom_object_factory_spec.rb
61
+ spec/rhom_spec.rb
61
62
  spec/source_generator_spec.rb
62
63
  spec/spec.opts
63
64
  spec/spec_helper.rb
data/lib/rhodes.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  module Rhodes
2
2
  unless defined? Rhodes::VERSION
3
- VERSION = '0.2.6'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  unless defined? Rhodes::DBVERSION
6
- DBVERSION = '0.2.2'
6
+ DBVERSION = '0.2.6'
7
7
  end
8
8
 
9
9
  end
data/lib/rhom/rhom.rb CHANGED
@@ -38,9 +38,21 @@ module Rhom
38
38
  @factory = RhomObjectFactory.new
39
39
  end
40
40
 
41
- def self.client_id
42
- c_id = ::Rhom::RhomDbAdapter::select_from_table('client_info','client_id')[0]
43
- c_id.nil? ? nil : c_id['client_id']
44
- end
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
@@ -14,6 +14,14 @@ class SyncEngine
14
14
  end
15
15
  def self.unlock_sync_mutex
16
16
  end
17
+ def self.login
18
+ 1
19
+ end
20
+ def self.logout
21
+ end
22
+ def self.logged_in
23
+ 1
24
+ end
17
25
  end
18
26
  require 'rho'
19
27
  class << Rho::RhoFSConnector
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.2.6
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-01-29 00:00:00 -08:00
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