nitro 0.9.5 → 0.10.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.
Files changed (104) hide show
  1. data/ChangeLog +260 -0
  2. data/INSTALL +60 -0
  3. data/LICENSE +1 -0
  4. data/README +19 -20
  5. data/RELEASES +48 -0
  6. data/Rakefile +102 -92
  7. data/benchmark/og/bench.rb +74 -0
  8. data/benchmark/og/sqlite-no-prepare.1.txt +13 -0
  9. data/benchmark/og/sqlite-no-prepare.2.txt +13 -0
  10. data/benchmark/og/sqlite-prepare.1.txt +13 -0
  11. data/benchmark/og/sqlite-prepare.2.txt +13 -0
  12. data/bin/cluster +1 -1
  13. data/bin/nitro +3 -0
  14. data/bin/proto/conf/app.conf.rb +2 -10
  15. data/examples/README.windows +9 -0
  16. data/examples/blog/README +16 -4
  17. data/examples/blog/lib/blog.rb +3 -3
  18. data/examples/blog/lib/blog/controller.rb +7 -9
  19. data/examples/blog/root/fcgi.rb +2 -4
  20. data/examples/blog/root/style.xsl +4 -6
  21. data/examples/blog/run.rb +41 -0
  22. data/examples/flash/run.rb +9 -0
  23. data/examples/no_xsl_blog/README +0 -1
  24. data/examples/no_xsl_blog/conf/app.conf.rb +6 -13
  25. data/examples/no_xsl_blog/lib/blog.rb +2 -2
  26. data/examples/no_xsl_blog/lib/blog/controller.rb +6 -6
  27. data/examples/no_xsl_blog/root/fcgi.rb +2 -4
  28. data/examples/no_xsl_blog/run.rb +38 -0
  29. data/examples/og/mock_example.rb +0 -2
  30. data/examples/og/mysql_to_psql.rb +0 -2
  31. data/examples/og/run.rb +23 -22
  32. data/examples/tiny/root/fcgi.rb +2 -4
  33. data/examples/tiny/root/index.xhtml +21 -5
  34. data/examples/tiny/root/upload.xhtml +23 -0
  35. data/examples/tiny/run.rb +9 -0
  36. data/examples/wee_style/{wee.rb → run.rb} +13 -13
  37. data/install.rb +44 -0
  38. data/lib/glue/array.rb +6 -10
  39. data/lib/glue/attribute.rb +0 -3
  40. data/lib/glue/cache.rb +1 -1
  41. data/lib/glue/inflector.rb +5 -5
  42. data/lib/glue/mixins.rb +3 -12
  43. data/lib/glue/number.rb +1 -1
  44. data/lib/glue/object.rb +7 -1
  45. data/lib/glue/property.rb +32 -22
  46. data/lib/glue/string.rb +13 -75
  47. data/lib/glue/time.rb +2 -2
  48. data/lib/glue/validation.rb +7 -11
  49. data/lib/nitro.rb +16 -1
  50. data/lib/nitro/{adaptors → adapters}/cgi.rb +101 -20
  51. data/lib/nitro/{adaptors → adapters}/fastcgi.rb +3 -2
  52. data/lib/nitro/{adaptors → adapters}/webrick.rb +4 -4
  53. data/lib/nitro/builders/rss.rb +1 -1
  54. data/lib/nitro/builders/xml.rb +8 -10
  55. data/lib/nitro/cluster.rb +1 -1
  56. data/lib/nitro/conf.rb +34 -0
  57. data/lib/nitro/controller.rb +8 -9
  58. data/lib/nitro/dispatcher.rb +38 -11
  59. data/lib/nitro/filters.rb +1 -1
  60. data/lib/nitro/markup.rb +14 -1
  61. data/lib/nitro/render.rb +7 -10
  62. data/lib/nitro/runner.rb +232 -0
  63. data/lib/nitro/ui/pager.rb +2 -6
  64. data/lib/nitro/uri.rb +7 -11
  65. data/lib/og.rb +27 -261
  66. data/lib/og/adapter.rb +352 -0
  67. data/lib/og/adapters/mysql.rb +304 -0
  68. data/lib/og/adapters/psql.rb +286 -0
  69. data/lib/og/adapters/sqlite.rb +262 -0
  70. data/lib/og/backend.rb +1 -1
  71. data/lib/og/connection.rb +123 -87
  72. data/lib/og/database.rb +268 -0
  73. data/lib/og/meta.rb +23 -22
  74. data/lib/og/mock.rb +2 -3
  75. data/lib/xsl/base.xsl +1 -55
  76. data/test/glue/tc_property.rb +2 -0
  77. data/test/glue/tc_property_type_checking.rb +32 -0
  78. data/test/glue/tc_strings.rb +2 -2
  79. data/test/glue/tc_validation.rb +2 -0
  80. data/test/nitro/adapters/raw_post1.bin +0 -0
  81. data/test/nitro/{adaptors → adapters}/tc_cgi.rb +11 -2
  82. data/test/nitro/{adaptors → adapters}/tc_webrick.rb +3 -3
  83. data/test/nitro/builders/tc_xml.rb +14 -5
  84. data/test/nitro/tc_dispatcher.rb +3 -3
  85. data/test/nitro/tc_uri.rb +2 -4
  86. data/test/og/tc_lifecycle.rb +22 -25
  87. data/test/og/tc_sqlite.rb +87 -0
  88. data/test/tc_og.rb +61 -42
  89. metadata +67 -33
  90. data/examples/blog/conf/app.conf.rb +0 -52
  91. data/examples/blog/ctl +0 -4
  92. data/examples/flash/conf/app.conf.rb +0 -21
  93. data/examples/flash/ctl +0 -4
  94. data/examples/no_xsl_blog/conf/apache.conf +0 -0
  95. data/examples/no_xsl_blog/ctl +0 -4
  96. data/examples/tiny/conf/app.conf.rb +0 -17
  97. data/examples/tiny/ctl +0 -4
  98. data/lib/glue/macro.rb +0 -56
  99. data/lib/nitro/adaptors/runner.rb +0 -123
  100. data/lib/nitro/version.rb +0 -15
  101. data/lib/og/backends/mysql.rb +0 -370
  102. data/lib/og/backends/psql.rb +0 -386
  103. data/lib/og/backends/sqlite.rb +0 -383
  104. data/lib/og/version.rb +0 -9
@@ -12,6 +12,8 @@ end
12
12
  NotNull = {:sql => "NOT NULL"}.freeze
13
13
  Null = {:sql => "NULL"}.freeze
14
14
 
15
+ Property.type_checking = false
16
+
15
17
  module Test # :nodoc: all
16
18
 
17
19
  class Msg
@@ -0,0 +1,32 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
2
+
3
+ require 'test/unit'
4
+
5
+ require 'glue/logger'
6
+ require 'glue/property'
7
+
8
+ N::Property.type_checking = true
9
+
10
+ module Test # :nodoc: all
11
+
12
+ class Person
13
+ prop_accessor :age, Fixnum
14
+
15
+ def initialize(age = nil)
16
+ @age = age
17
+ end
18
+
19
+ end
20
+
21
+ class TC_PropertiesTypeChecking < Test::Unit::TestCase
22
+
23
+ def test_all
24
+ per = Person.new
25
+ assert_raises(RuntimeError) {
26
+ per.age = 'Hello'
27
+ }
28
+ end
29
+
30
+ end
31
+
32
+ end
@@ -76,7 +76,7 @@ class TC_StringUtilsUtils < Test::Unit::TestCase
76
76
  assert_equal("", N::StringUtils::wrap("", 4, " "))
77
77
  assert_equal(nil, N::StringUtils::wrap(nil, 4, " "))
78
78
  end
79
-
79
+ =begin
80
80
  def test_rationalize_filename
81
81
  filename = N::StringUtils.rationalize_filename("hello my friend!.gif")
82
82
  assert_equal("hello-my-friend.gif", filename)
@@ -89,7 +89,7 @@ class TC_StringUtilsUtils < Test::Unit::TestCase
89
89
  filename = N::StringUtils.rationalize_filename("image-(10).gif")
90
90
  assert_equal("image-10.gif", filename)
91
91
  end
92
-
92
+ =end
93
93
  def test_random_string
94
94
  s1 = N::StringUtils.random()
95
95
  s2 = N::StringUtils.random()
@@ -5,6 +5,8 @@ require 'test/unit'
5
5
  require 'glue'
6
6
  require 'glue/validation'
7
7
 
8
+ Property.type_checking = false
9
+
8
10
  class TC_Validation < Test::Unit::TestCase # :nodoc: all
9
11
 
10
12
  # Override the default error message
Binary file
@@ -4,9 +4,9 @@ require 'ostruct'
4
4
  require 'test/unit'
5
5
 
6
6
  require 'nitro/cookie'
7
- require 'nitro/adaptors/cgi'
7
+ require 'nitro/adapters/cgi'
8
8
 
9
- class TC_AdaptorsCgi < Test::Unit::TestCase # :nodoc: all
9
+ class TC_AdaptersCgi < Test::Unit::TestCase # :nodoc: all
10
10
  include N
11
11
 
12
12
  def test_parse_query_parameters
@@ -60,4 +60,13 @@ class TC_AdaptorsCgi < Test::Unit::TestCase # :nodoc: all
60
60
  res = "HTTP/1.1 200 OK \r\nContent-Type: text/html\r\nSet-Cookie: nauthnauth=gmosx\r\nSet-Cookie: nsidnsid=1233\r\n\r\n"
61
61
  assert_equal res, CgiUtils.response_headers(ctx)
62
62
  end
63
+ =begin
64
+ def test_parse_multipart
65
+ context = OpenStruct.new
66
+ context.in = File.open(File.join(File.dirname(__FILE__), 'raw_post1.bin'))
67
+ context.headers = { 'CONTENT_LENGTH' => 11963 }
68
+ boundary = '---------------------------277124474474241471962886717'
69
+ CgiUtils.parse_multipart(context, boundary)
70
+ end
71
+ =end
63
72
  end
@@ -3,13 +3,13 @@ $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
3
3
  require 'test/unit'
4
4
  require 'ostruct'
5
5
 
6
- require 'nitro/adaptors/webrick'
6
+ require 'nitro/adapters/webrick'
7
7
 
8
- class TC_Webrick < Test::Unit::TestCase # :nodoc: all
8
+ class TC_AdaptersWebrick < Test::Unit::TestCase # :nodoc: all
9
9
  include N
10
10
 
11
11
  def test_adaptor
12
- # w = WebrickAdaptor.new()
12
+ # w = WebrickAdapter.new()
13
13
  end
14
14
 
15
15
  end
@@ -4,9 +4,10 @@ require 'test/unit'
4
4
  require 'nitro/builders/xml'
5
5
 
6
6
  class TC_BuildersXml < Test::Unit::TestCase # :nodoc: all
7
+ include N
7
8
 
8
9
  def test_string
9
- x = N::XmlString.new
10
+ x = XmlString.new
10
11
 
11
12
  x.start_tag('html').
12
13
  start_tag('title').text('hello').end_tag('title').
@@ -16,26 +17,34 @@ class TC_BuildersXml < Test::Unit::TestCase # :nodoc: all
16
17
  end
17
18
 
18
19
  def test_missing
19
- x = N::XmlString.new
20
+ x = XmlString.new
20
21
  x.b('This is bold')
21
22
  assert_equal '<b>This is bold</b>', x
22
23
 
23
- x = N::XmlString.new
24
+ x = XmlString.new
24
25
  x.a('Navel', :href => 'http://www.navel.gr')
25
26
  assert_equal '<a href="http://www.navel.gr">Navel</a>', x
26
27
 
27
28
 
28
- x = N::XmlString.new
29
+ x = XmlString.new
29
30
  x.b {
30
31
  x.i 'Hello', :class =>'new'
31
32
  x.p 'Paragraph'
32
33
  }
33
34
  assert_equal '<b><i class="new">Hello</i><p>Paragraph</p></b>', x
35
+
36
+ x = XmlString.new
37
+ x.hr
38
+ assert_equal '<hr />', x
39
+
40
+ x = XmlString.new
41
+ x.hr(:style => 'height: 1px')
42
+ assert_equal '<hr style="height: 1px" />', x
34
43
  end
35
44
 
36
45
  def test_xml_builder
37
46
  buffer = ''
38
- x = N::XmlBuilder.new(buffer)
47
+ x = XmlBuilder.new(buffer)
39
48
 
40
49
  x.start_tag('html').
41
50
  start_tag('title').text('hello').end_tag('title').
@@ -13,12 +13,12 @@ class TC_Dispatcher < Test::Unit::TestCase # :nodoc: all
13
13
 
14
14
  def setup
15
15
  @d = N::Dispatcher.new({
16
- :index => MainController,
16
+ :root => MainController,
17
17
  'blog' => BlogController
18
18
  })
19
19
 
20
20
  @dxml = N::Dispatcher.new({
21
- :index => MainController,
21
+ :root => MainController,
22
22
  'blog' => BlogController
23
23
  })
24
24
  @dxml.add_api('xml', 'xml')
@@ -30,7 +30,7 @@ class TC_Dispatcher < Test::Unit::TestCase # :nodoc: all
30
30
 
31
31
  def test_initialize
32
32
  d = N::Dispatcher.new(BlogController)
33
- assert_equal BlogController, d.controllers[:index]
33
+ assert_equal BlogController, d.controllers[:root]
34
34
  end
35
35
 
36
36
  def test_dispatch
data/test/nitro/tc_uri.rb CHANGED
@@ -3,13 +3,11 @@ require "nitro/uri"
3
3
 
4
4
  include N
5
5
 
6
- class Dummy
7
- # :nodoc: all
6
+ class Dummy # :nodoc: all
8
7
  attr_accessor :test1, :test2
9
8
  end
10
9
 
11
- class TC_Uri < Test::Unit::TestCase
12
- # :nodoc: all
10
+ class TC_Uri < Test::Unit::TestCase # :nodoc: all
13
11
 
14
12
  def test_query_string_to_hash
15
13
  # bad query string
@@ -1,43 +1,40 @@
1
1
  #! /usr/bin/env ruby
2
2
  # vim:sw=2:ai
3
3
 
4
- # code:
5
4
  # * Thomas Quas <tquas@yahoo.com>
6
5
  # * George Moschovitis <gm@navel.gr>
7
- #
8
6
  # $Id$
9
7
 
10
8
  $LOAD_PATH.unshift 'lib'
11
9
 
12
- require "test/unit"
10
+ require 'test/unit'
13
11
  require 'glue/logger'
14
12
  require 'og/mock'
15
13
 
16
14
  $DBG = false
17
- $log = Logger.new( STDERR ) unless $log
18
15
 
19
16
  class Dummy
20
- prop_accessor :date
17
+ prop_accessor :date, Time
21
18
  attr_reader :call_stack
22
19
 
23
20
  def og_pre_insert( oid )
24
- @call_stack << "pre_insert"
21
+ @call_stack << 'pre_insert'
25
22
  end
26
23
 
27
24
  def og_post_insert( oid )
28
- @call_stack << "post_insert"
25
+ @call_stack << 'post_insert'
29
26
  end
30
27
 
31
28
  def og_pre_update( oid )
32
- @call_stack << "pre_update"
29
+ @call_stack << 'pre_update'
33
30
  end
34
31
 
35
32
  def og_post_update( oid )
36
- @call_stack << "post_update"
33
+ @call_stack << 'post_update'
37
34
  end
38
35
 
39
36
  def self.og_pre_delete( conn, oid )
40
- raise "undeletable"
37
+ raise 'undeletable'
41
38
  end
42
39
 
43
40
  def initialize
@@ -51,8 +48,8 @@ class TC_CallbackTest < ::Test::Unit::TestCase
51
48
  obj = Dummy.new
52
49
  obj.save!
53
50
 
54
- assert( obj.call_stack.shift == "pre_insert" )
55
- assert( obj.call_stack.shift == "post_insert" )
51
+ assert( obj.call_stack.shift == 'pre_insert' )
52
+ assert( obj.call_stack.shift == 'post_insert' )
56
53
  assert( obj.call_stack.empty? )
57
54
  end
58
55
 
@@ -75,7 +72,7 @@ class TC_CallbackTest < ::Test::Unit::TestCase
75
72
  obj.call_stack.shift
76
73
  obj.call_stack.shift
77
74
 
78
- assert_raise( RuntimeError, "undeletable" ) { obj.delete! }
75
+ assert_raise( RuntimeError, 'undeletable' ) { obj.delete! }
79
76
  end
80
77
 
81
78
  def setup
@@ -83,25 +80,25 @@ class TC_CallbackTest < ::Test::Unit::TestCase
83
80
 
84
81
  if psql
85
82
  config = {
86
- :backend => "psql",
87
- :address => "localhost",
88
- :database => "test",
89
- :user => "postgres",
90
- :password => "navelrulez",
83
+ :adapter => 'psql',
84
+ # :address => 'localhost',
85
+ :database => 'test',
86
+ :user => 'postgres',
87
+ :password => 'navelrulez',
91
88
  :connection_count => 1
92
89
  }
93
90
  else
94
91
  config = {
95
- :backend => "mysql",
96
- :address => "localhost",
97
- :database => "test",
98
- :user => "root",
99
- :password => "navelrulez",
92
+ :adapter => 'mysql',
93
+ # :address => 'localhost',
94
+ :database => 'test',
95
+ :user => 'root',
96
+ :password => 'navelrulez',
100
97
  :connection_count => 1
101
98
  }
102
99
  end
103
- Og::Database.drop_db!( config )
104
- $og = Og::Database.new( config )
100
+ Og::Database.drop_db!(config)
101
+ $og = Og::Database.new(config)
105
102
  $og.get_connection()
106
103
  end
107
104
  end
@@ -0,0 +1,87 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
2
+
3
+ =begin
4
+
5
+ require 'test/unit'
6
+ require 'ostruct'
7
+
8
+ require 'og'
9
+ require 'og/adapters/sqlite'
10
+
11
+ class TC_OgSqlite3 < Test::Unit::TestCase # :nodoc: all
12
+ include N
13
+
14
+ # Forward declaration.
15
+
16
+ class Comment; end
17
+
18
+ class Article
19
+ prop_accessor :name, String
20
+ prop_accessor :age, Fixnum
21
+ has_many :comments, Comment
22
+
23
+ def initialize (name = nil, age = nil)
24
+ @name, @age = name, age
25
+ end
26
+ end
27
+
28
+ class Comment
29
+ prop_accessor :text, String
30
+ belongs_to :article, Article
31
+
32
+ def initialize(text = nil)
33
+ @text = text
34
+ end
35
+ end
36
+
37
+ def setup
38
+ config = {
39
+ :adapter => 'sqlite',
40
+ :database => 'test',
41
+ :connection_count => 2
42
+ }
43
+
44
+ $DBG = true
45
+
46
+ Og::Database.drop_db!(config)
47
+ @og = Og::Database.new(config)
48
+ end
49
+
50
+ def teardown
51
+ @og.shutdown
52
+ end
53
+
54
+ def test_all
55
+ a = Article.new('gmosx', 30)
56
+ a.save!
57
+
58
+ a1 = Article[1]
59
+
60
+ assert_equal 'gmosx', a1.name
61
+ assert_equal 30, a1.age
62
+ assert_equal 1, a1.oid
63
+
64
+ Article.create('drak', 12)
65
+ Article.create('ekarak', 34)
66
+ Article.create('mario', 53)
67
+ Article.create('elathan', 34)
68
+
69
+ articles = Article.all
70
+
71
+ assert_equal 5, articles.size
72
+
73
+ a3 = Article[3]
74
+
75
+ assert_equal 'ekarak', a3.name
76
+
77
+ c1 = Comment.new('a comment')
78
+ c1.save!
79
+ a3.add_comment(c1)
80
+
81
+ a5 = Article[3]
82
+ assert_equal 1, a5.comments.size
83
+ end
84
+
85
+ end
86
+
87
+ =end
data/test/tc_og.rb CHANGED
@@ -85,52 +85,59 @@ class OrderItem
85
85
  end
86
86
 
87
87
  class TC_N_OG < Test::Unit::TestCase
88
+ def test_psql
89
+ config = {
90
+ :adapter => 'psql',
91
+ # :address => 'localhost',
92
+ :database => 'test',
93
+ :user => 'postgres',
94
+ :password => 'navelrulez',
95
+ :connection_count => 2
96
+ }
97
+
98
+ run_all_tests(config)
99
+ end
88
100
 
89
- def setup
90
- psql = true
91
-
92
- if psql
93
- config = {
94
- :backend => "psql",
95
- :address => "localhost",
96
- :database => "test",
97
- :user => "postgres",
98
- :password => "navelrulez",
99
- :connection_count => 1
100
- }
101
- else
102
- config = {
103
- :backend => "mysql",
104
- :address => "localhost",
105
- :database => "test",
106
- :user => "root",
107
- :password => "navelrulez",
108
- :connection_count => 1
109
- }
110
- end
111
-
112
- Og::Database.drop_db!(config)
113
- $og = Og::Database.new(config)
101
+ =begin
102
+ def test_mysql
103
+ config = {
104
+ :adapter => 'mysql',
105
+ # :address => 'localhost',
106
+ :database => 'test',
107
+ :user => 'root',
108
+ :password => 'navelrulez',
109
+ :connection_count => 2
110
+ }
111
+
112
+ run_all_tests(config)
114
113
  end
115
114
 
116
- def teardown
117
- $og.shutdown()
115
+ def test_sqlite
116
+ config = {
117
+ :adapter => 'sqlite',
118
+ :database => 'test',
119
+ :connection_count => 2
120
+ }
121
+
122
+ run_all_tests(config)
118
123
  end
124
+ =end
119
125
 
120
126
  # gmosx: hmm, implemented in one method to enforce order.
121
- #
122
- def test_all
123
- $DBG = true
127
+
128
+ def run_all_tests(config)
129
+ Og::Database.drop_db!(config)
130
+ og = Og::Database.new(config)
124
131
 
125
- $og.get_connection()
132
+ og.get_connection
126
133
 
127
134
  article = Article.new("Title", "Here comes the body")
128
- $og << article
135
+ og << article
129
136
 
130
137
  article.title = "Changed"
131
138
  article.save!
132
139
 
133
- $og.pupdate("body='Hello'", article)
140
+ og.pupdate("body='Hello'", article)
134
141
 
135
142
  article.update_properties "body='Hello'"
136
143
 
@@ -143,9 +150,9 @@ class TC_N_OG < Test::Unit::TestCase
143
150
  another.options = nil
144
151
  another.save!
145
152
 
146
- assert_equal(nil, $og.load(30000, Article))
153
+ assert_equal(nil, og.load(30000, Article))
147
154
 
148
- articles = $og.load_all(Article)
155
+ articles = og.load_all(Article)
149
156
 
150
157
  # p articles
151
158
  # p Article[23]
@@ -157,9 +164,9 @@ class TC_N_OG < Test::Unit::TestCase
157
164
 
158
165
  assert_equal("gmosx", user.name)
159
166
 
160
- users1 = $og.select("name='gmosx' ORDER BY oid", User)
167
+ users1 = og.select("name='gmosx' ORDER BY oid", User)
161
168
 
162
- users = $og.select("SELECT * FROM #{User::DBTABLE} WHERE name='gmosx' ORDER BY oid", User)
169
+ users = og.select("SELECT * FROM #{User::DBTABLE} WHERE name='gmosx' ORDER BY oid", User)
163
170
 
164
171
  users2 = User.select "name='gmosx' ORDER BY oid"
165
172
 
@@ -173,7 +180,6 @@ class TC_N_OG < Test::Unit::TestCase
173
180
  comment.author = User["gmosx"]
174
181
  comment.save!
175
182
 
176
-
177
183
  # test automatically generated add_commnet
178
184
  comment = Comment.new("This is another comment")
179
185
  comment.author = User["gmosx"]
@@ -195,8 +201,10 @@ class TC_N_OG < Test::Unit::TestCase
195
201
  article.add_comment(Comment.new("hello"))
196
202
  article.add_comment(Comment.new("world"))
197
203
 
204
+ assert_equal 2, Comment.count
205
+
198
206
  Article.delete(article)
199
-
207
+
200
208
  assert Comment.all.empty?
201
209
 
202
210
  comment.delete!
@@ -210,14 +218,14 @@ class TC_N_OG < Test::Unit::TestCase
210
218
  end
211
219
  end
212
220
 
213
- assert($og.managed_classes.include?(Test::Article))
221
+ assert(og.managed_classes.include?(Test::Article))
214
222
 
215
223
  # bug: indirectly managed (includes managed Module)
216
- assert($og.managed_classes.include?(Test::MyClass))
224
+ assert(og.managed_classes.include?(Test::MyClass))
217
225
 
218
226
  # test create
219
227
  article = Article.create("title", "body")
220
- assert_equal(3, article.oid)
228
+ # assert_equal(3, article.oid)
221
229
 
222
230
  # test refers_to
223
231
 
@@ -235,7 +243,18 @@ class TC_N_OG < Test::Unit::TestCase
235
243
 
236
244
  user = User['gmosx']
237
245
  assert_equal true, user.banned
246
+
247
+ og.put_connection
248
+ og.shutdown
249
+
250
+ # Test database allready exists
251
+
252
+ og = Og::Database.new(config)
253
+
254
+ user = User.new("gmosx")
255
+ user.save!
238
256
 
257
+ og.shutdown
239
258
  end
240
259
 
241
260
  end