rhodes 0.2.5 → 0.2.6

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.2.6 2009-01-29
2
+ * changed signature of url_for, link_to, and redirect
3
+
1
4
  == 0.2.5 2009-01-28
2
5
  * erb labels are now humanized
3
6
 
data/Manifest.txt CHANGED
@@ -55,6 +55,7 @@ spec/configs/case.rb
55
55
  spec/configs/employee.rb
56
56
  spec/generator_spec_helper.rb
57
57
  spec/model_generator_spec.rb
58
+ spec/rho_controller_spec.rb
58
59
  spec/rho_spec.rb
59
60
  spec/rhom_object_factory_spec.rb
60
61
  spec/source_generator_spec.rb
@@ -30,20 +30,20 @@ class <%= class_name %>Controller < Rho::RhoController
30
30
  def create
31
31
  @<%= name %> = <%= class_name %>.new(@params['<%= name %>'])
32
32
  @<%= name %>.save
33
- redirect :index
33
+ redirect :action => :index
34
34
  end
35
35
 
36
36
  # POST /<%= class_name %>/1/update
37
37
  def update
38
38
  @<%= name %> = <%= class_name %>.find(@params['id'])
39
39
  @<%= name %>.update_attributes(@params['<%= name %>'])
40
- redirect :index
40
+ redirect :action => :index
41
41
  end
42
42
 
43
43
  # POST /<%= class_name %>/1/delete
44
44
  def delete
45
45
  @<%= name %> = <%= class_name %>.find(@params['id'])
46
46
  @<%= name %>.destroy
47
- redirect :index
47
+ redirect :action => :index
48
48
  end
49
49
  end
@@ -2,7 +2,7 @@
2
2
  class="panel"
3
3
  id="<%= name %>_edit_form"
4
4
  method="POST"
5
- action="<%%=url_for('update')%>">
5
+ action="<%%=url_for(:action => :update)%>">
6
6
  <fieldset>
7
7
  <input type="hidden" name="id" value="<%%=@<%= name %>.object%>"/>
8
8
  <% attributes.each do |attribute| %>
@@ -14,7 +14,7 @@
14
14
  </fieldset>
15
15
  <input type="submit" value="Update"/>
16
16
  <p align="center">
17
- <a href="<%%=url_for('delete', @<%= name %>.object)%>">
17
+ <a href="<%%=url_for(:action => :delete, :id => @<%= name %>.object)%>">
18
18
  <font color="#990000">Delete</font>
19
19
  </a>
20
20
  </p>
@@ -1,10 +1,10 @@
1
1
  <ul id="<%= name.pluralize %>" title="<%= class_name.pluralize %>">
2
2
  <%%@<%=name.pluralize%>.each do |x|%>
3
3
  <%if self.attributes?%>
4
- <li><%%=link_to "#{x.<%=attributes[0]%>}", "show", x.object%></li>
4
+ <li><%%=link_to "#{x.<%=attributes[0]%>}", :action => :show, :id => x.object%></li>
5
5
  <%else%>
6
6
  <li>Some list entry...</li>
7
7
  <%end%>
8
8
  <%%end%>
9
- <li><font color="blue"><%%=link_to "New <%= class_name %>", "new"%></font></li>
9
+ <li><font color="blue"><%%=link_to "New <%= class_name %>", :action => :new%></font></li>
10
10
  </ul>
@@ -2,7 +2,7 @@
2
2
  class="panel"
3
3
  id="<%= name %>_new_form"
4
4
  method="POST"
5
- action="<%%=url_for('create')%>">
5
+ action="<%%=url_for(:action => :create)%>">
6
6
  <fieldset>
7
7
  <input type="hidden" name="id" value="<%%=@<%= name %>.object%>"/>
8
8
  <% attributes.each do |attribute| %>
@@ -2,5 +2,5 @@
2
2
  <% attributes.each do |attribute| %>
3
3
  <li><%%=@<%=name%>.<%=attribute%>%></li>
4
4
  <% end %>
5
- <li><%%=link_to "Edit #{@<%=name%>.<%=attributes[0]%>}", "edit", @<%=name%>.object%></li>
5
+ <li><%%=link_to "Edit #{@<%=name%>.<%=attributes[0]%>}", :action => :edit, :id => @<%=name%>.object%></li>
6
6
  </ul>
data/lib/builtinME.rb CHANGED
@@ -154,7 +154,6 @@ class Array
154
154
  alias map! collect!
155
155
  alias size length
156
156
  alias to_ary to_a
157
- alias to_s inspect
158
157
 
159
158
  def inspect
160
159
  str = "["
@@ -168,6 +167,8 @@ class Array
168
167
  }
169
168
  str << "]"
170
169
  end
170
+
171
+ alias to_s inspect
171
172
 
172
173
  end
173
174
 
data/lib/rho/rho.rb CHANGED
@@ -34,7 +34,6 @@ module Rho
34
34
  # setup the sources table and model attributes for all applications
35
35
  def init_sources
36
36
  if defined? Rho::RhoConfig::sources
37
- src_attribs = []
38
37
 
39
38
  # quick and dirty way to get unique array of hashes
40
39
  uniq_sources = Rho::RhoConfig::sources.values.inject([]) { |result,h|
@@ -47,7 +46,6 @@ module Rho
47
46
  src_id = source['source_id']
48
47
  url = source['url']
49
48
  if !self.source_initialized?(src_id)
50
- puts "initializing source #{src_id}..."
51
49
  Rhom::RhomDbAdapter::insert_into_table('sources',
52
50
  {"source_id"=>src_id,"source_url"=>url})
53
51
  end
@@ -5,10 +5,6 @@ require 'rho/rhoviewhelpers'
5
5
  module Rho
6
6
  class RhoController
7
7
 
8
- #def initialize
9
- # self.class.layout 'layout'
10
- #end
11
-
12
8
  def default_action
13
9
  return Hash['GET','show','PUT','update','POST','update',
14
10
  'DELETE','delete'][@request['request-method']] unless @request['id'].nil?
@@ -28,11 +24,12 @@ module Rho
28
24
  end
29
25
  alias xhr? :xml_http_request?
30
26
 
31
- def redirect(action,id=nil)
32
- @response['status'] = 302
33
- @response['headers']['Location'] = url_for(action,id)
34
- @response['message'] = 'Moved temporarily'
27
+ def redirect(url_params = {},options = {})
28
+ @response['status'] = options['status'] || 302
29
+ @response['headers']['Location'] = url_for(url_params)
30
+ @response['message'] = options['message'] || 'Moved temporarily'
35
31
  return ''
36
32
  end
33
+
37
34
  end # RhoController
38
35
  end # Rho
@@ -1,45 +1,121 @@
1
1
  module Rho
2
2
  class RhoController
3
3
 
4
- def truncate(text, length)
5
- if text
6
- omission = '...'
7
- l = length - omission.length
8
- (text.length > length ? text[0...l] + omission : text).to_s
9
- end
10
- end
11
-
12
- def click_to_call(phone,description=nil)
13
- description = phone if description.nil?
14
- return "" if phone.nil? or phone.length == 0
15
- "<a href=\"tel:#{phone}\" target=\"_self\">#{description}</a>"
16
- end
17
-
18
- def mailto(address,description=nil)
19
- description = address if description.nil?
20
- return "" if address.nil? or address.length == 0
21
- "<a href=\"mailto:#{address}\" target=\"_self\">#{description}</a>"
22
- end
23
-
24
- def link_to(name,action,id=nil,confirm=nil)
25
- action = action.to_s
26
- if (action != 'delete')
27
- "<a href=\"#{url_for(action,id)}\">#{name}</a>"
4
+ def truncate(text,length)
5
+ if text
6
+ omission = '...'
7
+ l = length - omission.length
8
+ (text.length > length ? text[0...l] + omission : text).to_s
9
+ end
10
+ end
11
+
12
+ def click_to_call(phone,description=nil)
13
+ description = phone if description.nil?
14
+ return "" if phone.nil? or phone.length == 0
15
+ "<a href=\"tel:#{phone}\" target=\"_self\">#{description}</a>"
16
+ end
17
+
18
+ def mailto(address,description=nil)
19
+ description = address if description.nil?
20
+ return "" if address.nil? or address.length == 0
21
+ "<a href=\"mailto:#{address}\" target=\"_self\">#{description}</a>"
22
+ end
23
+
24
+ # Examples of how to use link_to method:
25
+ #
26
+ # link_to "Visit Other Site", "http://www.rhomobile.com/"
27
+ # ==> <a href=\"http://www.rhomobile.com/\" >Visit Other Site</a>
28
+ #
29
+ # link_to "Help", { :action => "help" }
30
+ # ==> <a href=\"/application/model/help\" >Help</a>
31
+ #
32
+ # link_to "Delete", { :action => "delete", :id => '{12}' }
33
+ # ==> <a href="/application/model/{12}/delete" onclick="var f = document.createElement('form');
34
+ # f.style.display = 'none';this.parentNode.appendChild(f); f.method = 'POST';
35
+ # f.action = this.href;f.submit();return false;">Delete</a>
36
+ #
37
+ # link_to "Show", { :action => "show", :id => '{12}'},"style=\"height:4px;width:7px;border-width:0px;\""
38
+ # ==> <a href="/application/model/{12}/show" style="height:4px;width:7px;border-width:0px;">Show</a>
39
+ #
40
+ # link_to "Delete", { :action => "delete", :id => '{12}' }, "class=\"delete_link\""
41
+ # ==> <a href="/application/model/{12}/delete" class="delete_link" onclick="var f = document.createElement('form');
42
+ # f.style.display = 'none';this.parentNode.appendChild(f); f.method = 'POST';
43
+ # f.action = this.href;f.submit();return false;\">Delete</a>"
44
+ #
45
+ # link_to "Invate",:action => :invite, :query => {:name => 'John Smith', 'address' => "http://john.smith.com"}
46
+ # ==> <a href="/application/model/invite?name=John%20Smith&address=http%3A%2F%2Fjohn.smith.com" >Invate</a>
47
+ #
48
+ def link_to(name,url_params = {},html_options = "",confirm = nil)
49
+ url = url_for(url_params)
50
+ if (url_params[:action].to_s != 'delete')
51
+ "<a href=\"#{url}\" #{html_options}>#{name || url}</a>"
28
52
  else
29
- "<a href=\"#{url_for(action,id)}\" onclick=\""+ #if (confirm('#{confirm}')) {
53
+ "<a href=\"#{url}\" #{html_options} onclick=\""+ #if (confirm('#{confirm}')) {
30
54
  "var f = document.createElement('form'); f.style.display = 'none';" +
31
- "this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;f.submit();"+
32
- "return false;\">#{name}</a>"
55
+ "this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;f.submit();"+
56
+ "return false;\">#{name || url}</a>"
33
57
  end
34
58
  end
35
59
 
36
- def url_for(action,id=nil)
37
- action = action.to_s
38
- amurl = '/'+@request['application']+'/'+@request['model']
39
- return action if action == '/'
40
- return amurl if action == 'create' or action == 'index'
41
- return amurl +'/'+ (id.nil? ? action.to_s : id.to_s + '/' + action.to_s)
60
+ # Examples of how to use url_for method:
61
+ #
62
+ # url_for '/some_url'
63
+ # ==> /some_url
64
+ #
65
+ # When generating a new URL, missing values may be filled in from the current request's parameters.
66
+ # For example, if application name or model are not specifyed in the call parameters, they would be filled from the request.
67
+ #
68
+ # url_for :action => :index
69
+ # ==> /application/model
70
+ #
71
+ # url_for :action => :create
72
+ # ==> /application/model
73
+ #
74
+ # url_for :action => :new
75
+ # ==> /application/model/new
76
+ #
77
+ # url_for :action => :show, :id => '{12}'
78
+ # ==> /application/model/{12}/show
79
+ #
80
+ # url_for :model => :another_model, :action => :show, :id => '{12}'
81
+ # ==> /application/another_model/{12}/show
82
+ #
83
+ # url_for :application => :another_app, :model => :another_model, :action => :show, :id => '{12}'
84
+ # ==> /another_app/another_model/{12}/show
85
+ #
86
+ # url_for :action => :create, :query => {:name => 'John Smith', 'address' => "http://john.smith.com"}
87
+ # ==> /application/model?name=John%20Smith&address=http%3A%2F%2Fjohn.smith.com
88
+ #
89
+ # url_for :action => :show, :id => '{12}', :fragment => "an-anchor"
90
+ # ==> /application/model/{12}/show#an-anchor
91
+ #
92
+ def url_for(params = {})
93
+ return params.to_s if params.is_a? String or params.is_a? Symbol
94
+ return '/' if not params.is_a? Hash or params.nil?
95
+
96
+ application = params[:application] || @request['application']
97
+ model = params[:model] || @request['model']
98
+ action = params[:action].nil? ? nil : params[:action].to_s
99
+ id = params[:id].nil? ? nil : params[:id].to_s
100
+ query = query_to_s(params[:query])
101
+ fragment = params[:fragment].nil? ? '' : '#' + params[:fragment]
102
+
103
+ amurl = '/' + application.to_s + '/' + model.to_s
104
+
105
+ return amurl + query + fragment if action.nil? or action == 'create' or action == 'index'
106
+ return amurl +'/'+ (id.nil? ? action : id + '/' + action) + query + fragment
42
107
  end
43
108
 
109
+ private
110
+ def query_to_s(query)
111
+ return '' if query.nil?
112
+ qstring = '?'
113
+ query.each do |key,value|
114
+ qstring += '&' if qstring.length > 1
115
+ qstring += ERB::Util.url_encode(key.to_s) + '=' + ERB::Util.url_encode(value.to_s)
116
+ end
117
+ qstring
118
+ end
119
+
44
120
  end # RhoController
45
121
  end # Rho
data/lib/rhodes.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Rhodes
2
2
  unless defined? Rhodes::VERSION
3
- VERSION = '0.2.5'
3
+ VERSION = '0.2.6'
4
4
  end
5
5
  unless defined? Rhodes::DBVERSION
6
6
  DBVERSION = '0.2.2'
data/lib/rhom/rhom.rb CHANGED
@@ -37,5 +37,10 @@ module Rhom
37
37
  def initialize
38
38
  @factory = RhomObjectFactory.new
39
39
  end
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
40
45
  end # Rhom
41
46
  end # Rhom
@@ -26,25 +26,9 @@ module Rhom
26
26
 
27
27
  def initialize
28
28
  unless not defined? Rho::RhoConfig::sources
29
- ::Rhom::RhomObjectFactory::init_source_attribs
30
29
  init_objects
31
30
  end
32
31
  end
33
-
34
- class << self
35
- def init_source_attribs
36
- # merge source attributes into config hash
37
- # TODO: This shouldn't reference 'source[1]' directly
38
- Rho::RhoConfig::sources.each do |source|
39
- src_attribs = ::Rhom::RhomDbAdapter::select_from_table(::Rhom::TABLE_NAME,
40
- 'attrib',
41
- {"source_id"=>source[1]['source_id'].to_s},
42
- {"distinct"=>true})
43
- # update our source with the proper attributes
44
- source[1].merge!({"attribs"=>src_attribs})
45
- end
46
- end
47
- end
48
32
 
49
33
  # Initialize new object with dynamic attributes
50
34
  def init_objects
@@ -60,12 +44,12 @@ module Rhom
60
44
  # create a temp id for the create type
61
45
  # TODO: This is duplicative of get_new_obj
62
46
  temp_objid = djb_hash(obj.values.to_s, 10).to_s
63
- self.send :object=, "#{temp_objid}"
64
- self.send :source_id=, obj['source_id'].to_s
65
- self.send :update_type=, 'create'
47
+ self.send("object=".to_sym(), temp_objid)
48
+ self.send("source_id=".to_sym(), obj['source_id'].to_s)
49
+ self.send("update_type=".to_sym(), 'create')
66
50
  obj.each do |key,value|
67
51
  val = self.inst_strip_braces(value)
68
- self.send "#{key}=".to_sym, val
52
+ self.send("#{key}=".to_sym(), val)
69
53
  end
70
54
  end
71
55
 
@@ -83,11 +67,6 @@ module Rhom
83
67
  list = []
84
68
  hash_list = {}
85
69
  conditions = {}
86
- attrib_length = 0
87
- source = Rho::RhoConfig::sources[self.name.to_s]
88
- attrib_length = source['attribs'].length if source
89
- # source attributes are not initialized, try again
90
- ::Rhom::RhomObjectFactory::init_source_attribs if attrib_length == 0
91
70
 
92
71
  # first find all query objects
93
72
  if args.first == :all
@@ -131,7 +110,7 @@ module Rhom
131
110
  # returns new model instance with a temp object id
132
111
  def get_new_obj(obj, type='query')
133
112
  tmp_obj = self.new
134
- tmp_obj.send :object=, "{#{obj['object'].to_s}}"
113
+ tmp_obj.send("object=".to_sym(), "{#{obj['object'].to_s}}")
135
114
  tmp_obj
136
115
  end
137
116
  end #class methods
@@ -0,0 +1,139 @@
1
+ #
2
+ # rho_controller_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
+ require 'rho/rhocontroller'
23
+
24
+ describe "Rho" do
25
+
26
+ it_should_behave_like "rho initializer"
27
+
28
+ describe "url_for and link_to" do
29
+
30
+ before(:each) do
31
+ @c = Rho::RhoController.new
32
+ @c.stub!(:send).and_return(nil)
33
+ @c.serve(nil,{'application' => 'application', 'model' => 'model'},{})
34
+ end
35
+
36
+ it "should generate urls for empty params" do
37
+ @c.url_for().should == '/application/model'
38
+ end
39
+
40
+ it "should generate urls for a url" do
41
+ @c.url_for('/some_url').should == '/some_url'
42
+ end
43
+
44
+ it "should generate urls for a symbol" do
45
+ @c.url_for(:new).should == 'new'
46
+ end
47
+
48
+ it "should generate urls for an action" do
49
+ @c.url_for(:action => :new).should == '/application/model/new'
50
+ end
51
+
52
+ it "should generate urls for an action and id" do
53
+ @c.url_for(:action => :show, :id => '{12}').should == '/application/model/{12}/show'
54
+ end
55
+
56
+ it "should generate urls for create or index actions" do
57
+ @c.url_for(:action => :index, :id => '{12}').should == '/application/model'
58
+ @c.url_for(:action => :create).should == '/application/model'
59
+ end
60
+
61
+ it "should generate urls for an model, action, and id" do
62
+ @c.url_for(:model => 'another_model', :action => :show, :id => '{12}').should == '/application/another_model/{12}/show'
63
+ @c.url_for(:model => :another_model, :action => :show, :id => '{12}').should == '/application/another_model/{12}/show'
64
+ end
65
+
66
+ it "should generate urls for an application, model, action, and id" do
67
+ @c.url_for(:application => :another_app, :model => :another_model,
68
+ :action => :show, :id => '{12}').should == '/another_app/another_model/{12}/show'
69
+ end
70
+
71
+ it "should generate urls with a query" do
72
+ @c.url_for(:action => :create, :query => {:name => 'John Smith',
73
+ 'address' => "http://john.smith.com"}).should == '/application/model?name=John%20Smith&address=http%3A%2F%2Fjohn.smith.com'
74
+ end
75
+
76
+ it "should generate urls with a fragment" do
77
+ @c.url_for(:action => :show, :id => '{12}', :fragment => "an-anchor").should == '/application/model/{12}/show#an-anchor'
78
+ end
79
+
80
+ it "should generate link for a url" do
81
+ @c.link_to("Visit Other Site", "http://www.rhomobile.com/").should == "<a href=\"http://www.rhomobile.com/\" >Visit Other Site</a>"
82
+ end
83
+
84
+ it "should generate link for an action" do
85
+ @c.link_to("Help", :action => "help").should == "<a href=\"/application/model/help\" >Help</a>"
86
+ end
87
+
88
+ it "should generate link for 'delete' action" do
89
+ @c.link_to("Delete", :action => "delete", :id => '{12}').should == "<a href=\"/application/model/{12}/delete\" onclick=\"var f = document.createElement('form'); f.style.display = 'none';this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;f.submit();return false;\">Delete</a>"
90
+ end
91
+
92
+ it "should generate link for an action and style it" do
93
+ @c.link_to("Show", { :action => "show", :id => '{12}'},"style=\"height:4px;width:7px;border-width:0px;\"").should == "<a href=\"/application/model/{12}/show\" style=\"height:4px;width:7px;border-width:0px;\">Show</a>"
94
+ end
95
+
96
+ it "should generate link for 'delete' action and style it" do
97
+ @c.link_to("Delete", { :action => "delete", :id => '{12}' }, "class=\"delete_link\"").should == "<a href=\"/application/model/{12}/delete\" class=\"delete_link\" onclick=\"var f = document.createElement('form'); f.style.display = 'none';this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;f.submit();return false;\">Delete</a>"
98
+ end
99
+
100
+ it "should generate link with a query" do
101
+ @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>"
102
+ end
103
+
104
+ end #describe "url_for and link_to"
105
+
106
+ describe "redirect" do
107
+
108
+ before(:each) do
109
+ @response = Hash.new
110
+ @response['headers'] = {}
111
+ @c = Rho::RhoController.new
112
+ @c.stub!(:send).and_return(nil)
113
+ @c.serve(nil,{'application' => 'application', 'model' => 'model'},@response)
114
+ end
115
+
116
+ it "should redirect to a url" do
117
+ @c.redirect "/start-page"
118
+ @response['headers']['Location'].should == "/start-page"
119
+ @response['status'].should == 302
120
+ @response['message'].should == 'Moved temporarily'
121
+ end
122
+
123
+ it "should redirect to an action" do
124
+ @c.redirect :action => :show, :id => '{12}'
125
+ @response['headers']['Location'].should == "/application/model/{12}/show"
126
+ @response['status'].should == 302
127
+ @response['message'].should == 'Moved temporarily'
128
+ end
129
+
130
+ it "should redirect to an action with 301 status code and status message" do
131
+ @c.redirect({:action => :show, :id => '{12}'}, {'status' => 301, 'message' => 'Moved permanently'})
132
+ @response['headers']['Location'].should == "/application/model/{12}/show"
133
+ @response['status'].should == 301
134
+ @response['message'].should == 'Moved permanently'
135
+ end
136
+
137
+ end #describe "redirect"
138
+
139
+ end
data/spec/rho_spec.rb CHANGED
@@ -21,39 +21,39 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
21
21
  require File.dirname(__FILE__) + "/spec_helper"
22
22
 
23
23
  describe "Rho" do
24
-
24
+
25
25
  it_should_behave_like "rho initializer"
26
26
 
27
27
  it "should populate configuration in sources table" do
28
28
  sources = Rhom::RhomDbAdapter::select_from_table('sources','*')
29
29
  sources.size.should > 1
30
30
  end
31
-
31
+
32
32
  it "should initialize configuration only once" do
33
33
  Rhom::RhomDbAdapter::delete_all_from_table('sources')
34
34
  @rho.source_initialized?(1).should == false
35
35
  @rho.init_sources
36
36
  @rho.source_initialized?(1).should == true
37
37
  end
38
-
38
+
39
39
  it "should have start_path" do
40
40
  Rho::RhoConfig.start_path.should == '/'
41
41
  end
42
-
42
+
43
43
  it "should set start_path" do
44
44
  Rho::RhoConfig.start_path = '/foo/bar'
45
45
  Rho::RhoConfig.start_path.should == '/foo/bar'
46
46
  end
47
-
47
+
48
48
  it "should retrieve start_path" do
49
49
  Rho::RhoConfig.start_path = '/'
50
50
  @rho.get_start_path.should == '/'
51
51
  end
52
-
52
+
53
53
  it "should return from get_app" do
54
54
  pending "fix relative paths for testing of get_app"
55
55
  end
56
-
56
+
57
57
  it "should serve request" do
58
58
  pending "need to mock request"
59
59
  end
@@ -32,9 +32,9 @@ describe "RhomObjectFactory" do
32
32
  end
33
33
 
34
34
  it "should set source_id attributes" do
35
- "1".should == Account.get_source_id
36
- "2".should == Case.get_source_id
37
- "3".should == Employee.get_source_id
35
+ Account.get_source_id.should == "1"
36
+ Case.get_source_id.should == "2"
37
+ Employee.get_source_id.should == "3"
38
38
  end
39
39
 
40
40
  it "should dynamically assign values" do
data/spec/stubs.rb CHANGED
@@ -20,4 +20,4 @@ class << Rho::RhoFSConnector
20
20
  def __rhoGetCurrentDir
21
21
  "../../../apps/"
22
22
  end
23
- end
23
+ end
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.5
4
+ version: 0.2.6
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-28 00:00:00 -08:00
12
+ date: 2009-01-29 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -172,6 +172,7 @@ files:
172
172
  - spec/configs/employee.rb
173
173
  - spec/generator_spec_helper.rb
174
174
  - spec/model_generator_spec.rb
175
+ - spec/rho_controller_spec.rb
175
176
  - spec/rho_spec.rb
176
177
  - spec/rhom_object_factory_spec.rb
177
178
  - spec/source_generator_spec.rb