nitro 0.29.0 → 0.30.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/CHANGELOG +410 -0
  2. data/ProjectInfo +36 -44
  3. data/README +5 -5
  4. data/doc/AUTHORS +6 -0
  5. data/doc/RELEASES +159 -2
  6. data/lib/glue/sweeper.rb +2 -2
  7. data/lib/glue/webfile.rb +14 -1
  8. data/lib/nitro.rb +6 -9
  9. data/lib/nitro/adapter/mongrel.rb +36 -43
  10. data/lib/nitro/adapter/scgi.rb +1 -1
  11. data/lib/nitro/adapter/webrick.rb +96 -24
  12. data/lib/nitro/caching/actions.rb +2 -1
  13. data/lib/nitro/caching/fragments.rb +1 -8
  14. data/lib/nitro/caching/output.rb +14 -4
  15. data/lib/nitro/cgi.rb +19 -21
  16. data/lib/nitro/cgi/cookie.rb +5 -1
  17. data/lib/nitro/cgi/request.rb +20 -4
  18. data/lib/nitro/compiler.rb +74 -28
  19. data/lib/nitro/compiler/cleanup.rb +1 -1
  20. data/lib/nitro/compiler/elements.rb +1 -2
  21. data/lib/nitro/compiler/localization.rb +1 -1
  22. data/lib/nitro/compiler/markup.rb +1 -1
  23. data/lib/nitro/compiler/script.rb +52 -44
  24. data/lib/nitro/compiler/squeeze.rb +4 -3
  25. data/lib/nitro/compiler/xslt.rb +7 -6
  26. data/lib/nitro/context.rb +39 -20
  27. data/lib/nitro/controller.rb +24 -5
  28. data/lib/nitro/dispatcher.rb +13 -5
  29. data/lib/nitro/global.rb +63 -0
  30. data/lib/nitro/helper/feed.rb +432 -0
  31. data/lib/nitro/helper/form.rb +11 -3
  32. data/lib/nitro/helper/form/builder.rb +140 -0
  33. data/lib/nitro/helper/form/controls.rb +2 -1
  34. data/lib/nitro/helper/javascript.rb +6 -0
  35. data/lib/nitro/helper/javascript/morphing.rb +13 -6
  36. data/lib/nitro/helper/xhtml.rb +42 -6
  37. data/lib/nitro/helper/xml.rb +3 -0
  38. data/lib/nitro/part.rb +2 -2
  39. data/lib/nitro/render.rb +7 -2
  40. data/lib/nitro/router.rb +57 -16
  41. data/lib/nitro/scaffolding.rb +29 -20
  42. data/lib/nitro/server.rb +4 -10
  43. data/lib/nitro/server/drb.rb +1 -1
  44. data/lib/nitro/server/runner.rb +10 -0
  45. data/lib/nitro/session.rb +31 -12
  46. data/lib/nitro/session/drb.rb +13 -1
  47. data/lib/nitro/session/file.rb +1 -1
  48. data/lib/nitro/session/memcached.rb +1 -1
  49. data/lib/nitro/session/memory.rb +1 -1
  50. data/lib/nitro/session/og.rb +1 -1
  51. data/lib/nitro/test/testcase.rb +3 -0
  52. data/proto/public/error.xhtml +5 -5
  53. data/proto/public/js/controls.js +2 -2
  54. data/proto/public/js/dragdrop.js +320 -79
  55. data/proto/public/js/effects.js +200 -152
  56. data/proto/public/js/prototype.js +284 -63
  57. data/proto/public/js/scriptaculous.js +7 -5
  58. data/proto/public/js/unittest.js +11 -0
  59. data/proto/public/scaffold/advanced_search.xhtml +30 -0
  60. data/proto/public/scaffold/list.xhtml +8 -1
  61. data/proto/public/scaffold/search.xhtml +2 -1
  62. data/proto/script/scgi_service +1 -1
  63. data/src/part/admin/controller.rb +1 -1
  64. data/src/part/admin/skin.rb +1 -1
  65. data/test/nitro/CONFIG.rb +3 -0
  66. data/test/nitro/adapter/tc_webrick.rb +1 -1
  67. data/test/nitro/cgi/tc_cookie.rb +1 -1
  68. data/test/nitro/cgi/tc_request.rb +5 -5
  69. data/test/nitro/compiler/tc_client_morpher.rb +47 -0
  70. data/test/nitro/compiler/tc_compiler.rb +2 -0
  71. data/test/nitro/helper/tc_feed.rb +138 -0
  72. data/test/nitro/helper/tc_pager.rb +1 -1
  73. data/test/nitro/helper/tc_rss.rb +1 -1
  74. data/test/nitro/helper/tc_table.rb +1 -1
  75. data/test/nitro/helper/tc_xhtml.rb +1 -1
  76. data/test/nitro/tc_caching.rb +1 -1
  77. data/test/nitro/tc_cgi.rb +1 -1
  78. data/test/nitro/tc_context.rb +1 -1
  79. data/test/nitro/tc_controller.rb +31 -3
  80. data/test/nitro/tc_controller_aspect.rb +1 -1
  81. data/test/nitro/tc_dispatcher.rb +1 -1
  82. data/test/nitro/tc_element.rb +1 -1
  83. data/test/nitro/tc_flash.rb +1 -1
  84. data/test/nitro/tc_helper.rb +1 -1
  85. data/test/nitro/tc_render.rb +6 -6
  86. data/test/nitro/tc_router.rb +8 -4
  87. data/test/nitro/tc_server.rb +1 -3
  88. data/test/nitro/tc_session.rb +1 -3
  89. metadata +107 -104
  90. data/Rakefile +0 -232
  91. data/lib/nitro/adapter/acgi.rb +0 -237
  92. data/proto/public/Makefile.acgi +0 -40
  93. data/proto/public/acgi.c +0 -138
@@ -20,16 +20,18 @@
20
20
  // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
22
  var Scriptaculous = {
23
- Version: '1.5.3',
23
+ Version: '1.6.1',
24
24
  require: function(libraryName) {
25
25
  // inserting via DOM fails in Safari 2.0, so brute force approach
26
26
  document.write('<script type="text/javascript" src="'+libraryName+'"></script>');
27
27
  },
28
28
  load: function() {
29
- if((typeof Prototype=='undefined') ||
30
- parseFloat(Prototype.Version.split(".")[0] + "." +
31
- Prototype.Version.split(".")[1]) < 1.4)
32
- throw("script.aculo.us requires the Prototype JavaScript framework >= 1.4.0");
29
+ if((typeof Prototype=='undefined') ||
30
+ (typeof Element == 'undefined') ||
31
+ (typeof Element.Methods=='undefined') ||
32
+ parseFloat(Prototype.Version.split(".")[0] + "." +
33
+ Prototype.Version.split(".")[1]) < 1.5)
34
+ throw("script.aculo.us requires the Prototype JavaScript framework >= 1.5.0");
33
35
 
34
36
  $A(document.getElementsByTagName("script")).findAll( function(s) {
35
37
  return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
@@ -258,6 +258,9 @@ Test.Unit.Assertions.prototype = {
258
258
  this.failures++;
259
259
  this.messages.push("Failure: " + message);
260
260
  },
261
+ info: function(message) {
262
+ this.messages.push("Info: " + message);
263
+ },
261
264
  error: function(error) {
262
265
  this.errors++;
263
266
  this.messages.push(error.name + ": "+ error.message + "(" + Test.Unit.inspect(error) +")");
@@ -336,6 +339,14 @@ Test.Unit.Assertions.prototype = {
336
339
  },
337
340
  assertVisible: function(element) {
338
341
  this.assert(this._isVisible(element), Test.Unit.inspect(element) + " was not visible. " + ("" || arguments[1]));
342
+ },
343
+ benchmark: function(operation, iterations) {
344
+ var startAt = new Date();
345
+ (iterations || 1).times(operation);
346
+ var timeTaken = ((new Date())-startAt);
347
+ this.info((arguments[2] || 'Operation') + ' finished ' +
348
+ iterations + ' iterations in ' + (timeTaken/1000)+'s' );
349
+ return timeTaken;
339
350
  }
340
351
  }
341
352
 
@@ -0,0 +1,30 @@
1
+ <SystemPage>
2
+ <?r base = "#{@base}/%base%" ?>
3
+ <h1><a href="/"> Home</a> > <a href="#@base">System</a> > <a href="#{base}/list">#{"%plural%".humanize}</a> > Advanced Search</h1>
4
+ <p>
5
+ <form action="#{base}/search">
6
+ Search #{"%plural%".humanize}: <input type="text" name="q" />&nbsp;<input type="submit" value="Search" />
7
+ <a href="#{base}/advanced_search">Advanced search</a>
8
+ </form>
9
+ </p>
10
+ <?r if @list.nil? ?>
11
+ <h3>Enter properties for advanced search:</h3>
12
+ #{form_for %klass%.new, :submit => 'Search', :action => :self, :no_relations => true}
13
+ <?r else ?>
14
+ <table>
15
+ <?r for obj in @list ?>
16
+ <tr>
17
+ <td width="100%"><a href="#{base}/edit/#{obj.oid}">#(obj.to_s)</a></td>
18
+ <?r if obj.respond_to?(:update_time) ?>
19
+ <td nowrap="1">#{obj.update_time.stamp(:db)}</td>
20
+ <?r end ?>
21
+ <td><a href="#{base}/edit/#{obj.oid}">edit</a></td>
22
+ <td><a href="#{base}/delete/#{obj.oid}">del</a></td>
23
+ </tr>
24
+ <?r end ?>
25
+ </table>
26
+ <div class="pager" if="@pager and @pager.navigation?">
27
+ #{@pager.navigation}
28
+ </div>
29
+ <?r end ?>
30
+ </SystemPage>
@@ -4,7 +4,8 @@
4
4
  <a href="#{base}/new">New #{"%name%".humanize}</a>
5
5
  <p>
6
6
  <form action="#{base}/search">
7
- Search #{"%plural%".humanize}: <input type="text" name="q" />&nbsp;<input type="submit" value="Search" />
7
+ Search #{"%plural%".humanize}: <input type="text" name="q" />&nbsp;<input type="submit" value="Search" />
8
+ <a href="#{base}/advanced_search">Advanced search</a>
8
9
  </form>
9
10
  </p>
10
11
  <table>
@@ -14,6 +15,12 @@
14
15
  <?r if obj.respond_to?(:update_time) ?>
15
16
  <td nowrap="1">#{obj.update_time.stamp(:db)}</td>
16
17
  <?r end ?>
18
+ <?r if Glue.const_defined?(:Orderable) and @klass.include?(Glue::Orderable) ?>
19
+ <td><a href="#">Top</a></td>
20
+ <td><a href="#">Up</a></td>
21
+ <td><a href="#">Down</a></td>
22
+ <td><a href="#">Bottom</a></td>
23
+ <?r end ?>
17
24
  <td><a href="#{base}/edit/#{obj.oid}">edit</a></td>
18
25
  <td><a href="#{base}/delete/#{obj.oid}" onclick="confirm('Are you sure?')">del</a></td>
19
26
  </tr>
@@ -3,7 +3,8 @@
3
3
  <h1><a href="/"> Home</a> > <a href="#@base">System</a> > <a href="#{base}/list">#{"%plural%".humanize}</a> > Search for '#@query'</h1>
4
4
  <p>
5
5
  <form action="#{base}/search">
6
- Search #{"%plural%".humanize}: <input type="text" name="q" />&nbsp;<input type="submit" value="Search" />
6
+ Search #{"%plural%".humanize}: <input type="text" name="q" />&nbsp;<input type="submit" value="Search" />
7
+ <a href="#{base}/advanced_search">Advanced search</a>
7
8
  </form>
8
9
  </p>
9
10
  <?r if @list.nil? ?>
@@ -24,7 +24,7 @@ class NitroProcessor < SCGIProcessor
24
24
  cgi.stdinput.rewind
25
25
  cgi.env["QUERY_STRING"] = (cgi.env["REQUEST_URI"] =~ /^[^?]+\?(.+)$/ and $1).to_s
26
26
  Nitro::Cgi.process($server, cgi, cgi.stdinput, cgi.stdoutput)
27
- Og.manager.put_store if defined?(Og) and Og.respond_to?(:manager)
27
+ Og.manager.put_store if defined?(Og) and Og.respond_to?(:manager) and Og.manager
28
28
  end
29
29
  rescue IOError
30
30
  @log.error("received IOError #$! when handling client. Your web server doesn't like me.")
@@ -40,7 +40,7 @@ class AdminController < Nitro::Controller
40
40
  # store the class instances.
41
41
 
42
42
  def destroy(klass)
43
- constant(klass).delete_all
43
+ constant(klass).destroy
44
44
  redirect_to_referer
45
45
  end
46
46
 
@@ -13,7 +13,7 @@ class SystemPage < Nitro::Element
13
13
  <body>
14
14
  <h1>#@title</h1>
15
15
  #{content}
16
- <p>Powered by <a href="http://www.nitrohq.com">Nitro</a> version #{Nitro::Version}</p>
16
+ <p>Powered by <a href="http://www.nitroproject.org">Nitro</a> version #{Nitro::Version}</p>
17
17
  </body>
18
18
  </html>
19
19
  ~
@@ -0,0 +1,3 @@
1
+ $NITRO_NO_ENVIRONMENT = true
2
+
3
+ require 'nitro'
@@ -1,4 +1,4 @@
1
- $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
1
+ require File.join(File.dirname(__FILE__), '..', 'CONFIG.rb')
2
2
 
3
3
  require 'test/unit'
4
4
  require 'ostruct'
@@ -1,4 +1,4 @@
1
- $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
1
+ require File.join(File.dirname(__FILE__), '..', 'CONFIG.rb')
2
2
 
3
3
  require 'test/unit'
4
4
 
@@ -1,4 +1,4 @@
1
- $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
1
+ require File.join(File.dirname(__FILE__), '..', 'CONFIG.rb')
2
2
 
3
3
  require 'test/unit'
4
4
 
@@ -16,12 +16,12 @@ class TC_Request < Test::Unit::TestCase # :nodoc: all
16
16
  def test_all
17
17
  req = DummyRequest.new
18
18
 
19
- req.headers['HTTP_HOST'] = 'www.nitrohq.com'
20
- assert_equal 'nitrohq.com', req.domain
19
+ req.headers['HTTP_HOST'] = 'www.nitroproject.org'
20
+ assert_equal 'nitroproject.org', req.domain
21
21
  assert_equal 'www', req.subdomains.first
22
22
 
23
- req.headers['HTTP_HOST'] = 'www.nitrohq.co.uk'
24
- assert_equal 'nitrohq.co.uk', req.domain(2)
23
+ req.headers['HTTP_HOST'] = 'www.nitroproject.co.uk'
24
+ assert_equal 'nitroproject.co.uk', req.domain(2)
25
25
 
26
26
  req.headers['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'
27
27
  assert req.xhr?
@@ -0,0 +1,47 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'CONFIG.rb')
2
+
3
+ require 'test/unit'
4
+
5
+ require 'nitro/test/testcase'
6
+ require 'nitro/compiler'
7
+
8
+ class TC_ClientMorpher < Test::Unit::TestCase
9
+ class MyController < Nitro::Controller
10
+ class Client
11
+ def check_album
12
+ ajax_update 'tools_block', {
13
+ :action => 'checked_albums',
14
+ :params => 'some parameters'
15
+ }
16
+ end
17
+ end
18
+ end
19
+
20
+ Action_Name = :an_object_responding_to_the_method_to_sym_is_now_required_when_compiling_a_template
21
+
22
+ def setup
23
+ @compiler = Nitro::Compiler.new(MyController)
24
+ end
25
+
26
+ def teardown
27
+ @compiler = nil
28
+ end
29
+
30
+ def test_javascript_no_params
31
+ template = '<a href="#" client="check_album">Test</a>'
32
+ result = @compiler.transform_template(Action_Name, template)
33
+ assert_match(/__nc_check_album\(\)/, result)
34
+ end
35
+
36
+ def test_javascript_one_param
37
+ template = '<a href="#" client="check_album" params="this.id">Test</a>'
38
+ result = @compiler.transform_template(Action_Name, template)
39
+ assert_match(/__nc_check_album\(this\.id\)/, result)
40
+ end
41
+
42
+ def test_javascript_multi_params
43
+ template = '<a href="#" client="check_album" params="this.id, this.class">Test</a>'
44
+ result = @compiler.transform_template(Action_Name, template)
45
+ assert_match(/__nc_check_album\(this\.id, this\.class\)/, result)
46
+ end
47
+ end
@@ -1,3 +1,5 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'CONFIG.rb')
2
+
1
3
  require 'test/unit'
2
4
 
3
5
  require 'nitro/test/testcase'
@@ -0,0 +1,138 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'CONFIG.rb')
2
+
3
+ require 'test/unit'
4
+ require 'nitro/helper/feed'
5
+
6
+ class TC_FeedHelper < Test::Unit::TestCase # :nodoc: all
7
+ include Nitro
8
+ include FeedHelper
9
+
10
+ Blog = Struct.new(:title, :body, :to_href)
11
+ Blog2 = Struct.new(:title, :body, :to_href, :update_time)
12
+ # TODO: add more (all)
13
+ FullBlown = Struct.new(:title, :body, :full_content, :to_href, :update_time, :create_time, :author)
14
+
15
+ # RSS Testing
16
+ def test_rss
17
+ blogs = []
18
+ blogs << Blog.new('Hello1', 'World1', 'uri1');
19
+ blogs << Blog.new('Hello2', 'World2', 'uri2');
20
+ blogs << Blog.new('Hello3', 'World3', 'uri3');
21
+ blogs2 = []
22
+ updated = Time.now
23
+ blogs2 << Blog2.new('Hello1', 'World1', 'uri1', updated);
24
+ blogs2 << Blog2.new('Hello2', 'World2', 'uri2', updated);
25
+ blogs2 << Blog2.new('Hello3', 'World3', 'uri3', updated);
26
+
27
+ # rss without version (0.9)
28
+ rss = build_rss(blogs, :base => 'http://oxyliquit.de')
29
+
30
+ assert_match %r{<link>http://oxyliquit.de/uri1</link>}, rss
31
+ assert_match %r{<link>http://oxyliquit.de/uri2</link>}, rss
32
+
33
+ # rss 0.9
34
+ rss09 = build_rss(blogs, :version => "0.91", :link => 'http://oxyliquit.de')
35
+ assert_match %r{<link>http://oxyliquit.de/uri1</link>}, rss09
36
+ assert_match %r{<link>http://oxyliquit.de/uri2</link>}, rss09
37
+
38
+ # rss 1.0
39
+ rss10 = build_rss(blogs, :version => "1.0", :link => 'http://oxyliquit.de')
40
+ assert_match %r{<link>http://oxyliquit.de/uri1</link>}, rss10
41
+ assert_match %r{<link>http://oxyliquit.de/uri2</link>}, rss10
42
+
43
+ # rss 2.0
44
+ rss20 = build_rss(blogs2, :version => "2.0", :link => 'http://oxyliquit.de')
45
+ assert_match %r{<link>http://oxyliquit.de/uri1</link>}, rss20
46
+ assert_match %r{<link>http://oxyliquit.de/uri2</link>}, rss20
47
+
48
+ # rss full blown
49
+ rssfull = build_rss(blogs, :version => "0.9", :base => 'http://oxyliquit.de', :link => 'http://oxyliquit.de/feed', :title => "Oxyliquit feed", :language => 'en', :about => 'http://ox.li/about.rdf', :description => "Example feed of Oxyliquit", :search_title => "Oxyliquit search", :search_description => "Search through Oxyliqit", :search_input_name => "q", :search_form_action => "http://oxyliquit.de/search")
50
+ assert_match %r{<link>http://oxyliquit.de/uri1</link>}, rssfull
51
+ assert_match %r{<link>http://oxyliquit.de/uri2</link>}, rssfull
52
+ # TODO: there should be some more
53
+
54
+ # rss with full blown object
55
+ update_time = Time.now
56
+ create_time = Time.now - 360
57
+ author = Hash.new
58
+ author[:name] = "Bill"
59
+ author[:link] = "http://bills.url"
60
+ author[:email] = "bill@email.com"
61
+ fullblownobject = []
62
+ fullblownobject << FullBlown.new('Hello1', 'World1', 'Fullsize text with lots of words..', 'uri1', update_time, create_time, author)
63
+ fullblownobject << FullBlown.new('Hello2', 'World2', ' text with lots of words..', 'uri2', update_time, create_time, author)
64
+ rss_f_o = build_rss(fullblownobject, :version => "0.9", :base => 'http://oxyliquit.de', :link => 'http://oxyliquit.de/feed', :title => "Oxyliquit feed", :language => 'en', :about => 'http://ox.li/about.rdf', :description => "Example feed of Oxyliquit", :search_title => "Oxyliquit search", :search_description => "Search through Oxyliqit", :search_input_name => "q", :search_form_action => "http://oxyliquit.de/search")
65
+ assert_match %r{<link>http://oxyliquit.de/uri1</link>}, rss_f_o
66
+ assert_match %r{<link>http://oxyliquit.de/uri2</link>}, rss_f_o
67
+
68
+ # rss with wrong version
69
+ assert_raise(RuntimeError) do
70
+ build_rss(blogs, :version => "0.5", :link => 'http://oxyliquit.de')
71
+ end
72
+
73
+ end # test_rss
74
+
75
+ # Atom Testing
76
+ def test_atom
77
+ blogs = []
78
+ updated = Time.now
79
+ blogs << Blog2.new('Hello1', 'World1', 'uri1', updated);
80
+ blogs << Blog2.new('Hello2', 'World2', 'uri2', updated);
81
+ blogs << Blog2.new('Hello3', 'World3', 'uri3', updated);
82
+
83
+ # atom small
84
+ atom = build_atom(blogs, :base => 'http://oxyliquit.de')
85
+
86
+ assert_match %r{<id>http://oxyliquit.de/uri1</id>}, atom
87
+ assert_match %r{<id>http://oxyliquit.de/uri2</id>}, atom
88
+
89
+ # atom big
90
+ atom = build_atom(blogs, :title => "Oxyliquit Feed", :base => "http://oxyliquit.de", :link => "http://oxyliquit.de/atomfeed", :author_name => "Fabian Buch", :author_email => "fabian@fabian-buch.de", :author_link => "http://fabian-buch.de")
91
+
92
+ assert_match %r{<id>http://oxyliquit.de/uri1</id>}, atom
93
+ assert_match %r{<id>http://oxyliquit.de/uri2</id>}, atom
94
+ assert_match %r{<title>Oxyliquit Feed</title>}, atom
95
+ assert_match %r{<updated>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|[+-]\d{2}:\d{2})</updated>}, atom
96
+
97
+ # atom with full blown object
98
+ update_time = Time.now
99
+ create_time = Time.now - 360
100
+ author = Hash.new
101
+ author[:name] = "Bill"
102
+ author[:link] = "http://bills.url"
103
+ author[:email] = "bill@email.com"
104
+ fullblownobject = []
105
+ fullblownobject << FullBlown.new('Hello1', 'World1', 'Fullsize text with lots of words..', 'uri1', update_time, create_time, author)
106
+ fullblownobject << FullBlown.new('Hello2', 'World2', ' text with lots of words..', 'uri2', update_time, create_time, author)
107
+ atom_f_o = build_atom(fullblownobject, :title => "Oxyliquit Feed", :base => "http://oxyliquit.de", :link => "http://oxyliquit.de/atomfeed", :author_name => "Fabian Buch", :author_email => "fabian@fabian-buch.de", :author_link => "http://fabian-buch.de")
108
+ assert_match %r{<id>http://oxyliquit.de/uri1</id>}, atom_f_o
109
+ assert_match %r{<id>http://oxyliquit.de/uri2</id>}, atom_f_o
110
+ assert_match %r{<title>Oxyliquit Feed</title>}, atom_f_o
111
+ assert_match %r{<summary>\w+</summary>}, atom_f_o
112
+ assert_match %r{<updated>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|[+-]\d{2}:\d{2})</updated>}, atom_f_o
113
+ assert_match %r{<published>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|[+-]\d{2}:\d{2})</published>}, atom_f_o
114
+ assert_match %r{<author><name>Bill</name><email>bill@email.com</email><uri>http://bills.url</uri></author>}, atom_f_o
115
+
116
+ end # test_atom
117
+
118
+ # OPML Testing
119
+ def test_opml
120
+
121
+ opml = build_opml(
122
+ {
123
+ "http://oxyliquit.de/feed" => "rss",
124
+ "http://oxyliquit.de/feed/questions" => "rss",
125
+ "http://oxyliquit.de/feed/tips" => "rss",
126
+ "http://oxyliquit.de/feed/tutorials" => "rss"
127
+ },
128
+ :title => "My feeds"
129
+ )
130
+
131
+ assert_match %r{<outline xmlUrl='http://oxyliquit.de/feed/tips' type='rss'/>}, opml
132
+
133
+ end # test_opml
134
+
135
+ end
136
+
137
+ # * Fabian Buch <fabian@fabian-buch.de>
138
+ # * George Moschovitis <gm@navel.gr>
@@ -1,4 +1,4 @@
1
- $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
1
+ require File.join(File.dirname(__FILE__), '..', 'CONFIG.rb')
2
2
 
3
3
  require 'test/unit'
4
4
 
@@ -1,4 +1,4 @@
1
- $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
1
+ require File.join(File.dirname(__FILE__), '..', 'CONFIG.rb')
2
2
 
3
3
  require 'test/unit'
4
4
  require 'nitro/helper/rss'
@@ -1,4 +1,4 @@
1
- $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
1
+ require File.join(File.dirname(__FILE__), '..', 'CONFIG.rb')
2
2
 
3
3
  require 'test/unit'
4
4
  require 'nitro/helper/table'
@@ -1,4 +1,4 @@
1
- $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
1
+ require File.join(File.dirname(__FILE__), '..', 'CONFIG.rb')
2
2
 
3
3
  require 'test/unit'
4
4
  require 'nitro/helper/xhtml'
@@ -1,4 +1,4 @@
1
- $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
1
+ require File.join(File.dirname(__FILE__), 'CONFIG.rb')
2
2
 
3
3
  require 'test/unit'
4
4
 
@@ -1,4 +1,4 @@
1
- $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
1
+ require File.join(File.dirname(__FILE__), 'CONFIG.rb')
2
2
 
3
3
  require 'stringio'
4
4
  require 'tempfile'
@@ -1,4 +1,4 @@
1
- $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
1
+ require File.join(File.dirname(__FILE__), 'CONFIG.rb')
2
2
 
3
3
  require 'test/unit'
4
4
  require 'ostruct'
@@ -1,6 +1,4 @@
1
- $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
2
-
3
- $NITRO_NO_ENVIRONMENT = true
1
+ require File.join(File.dirname(__FILE__), 'CONFIG.rb')
4
2
 
5
3
  require 'test/unit'
6
4
  require 'ostruct'
@@ -12,6 +10,11 @@ require 'nitro'
12
10
  class TC_Controller < Test::Unit::TestCase # :nodoc: all
13
11
  include Nitro
14
12
 
13
+ class Blog1Controller < Controller
14
+ def list
15
+ end
16
+ end
17
+
15
18
  class Blog2Controller < Controller
16
19
  attr_reader :aqflag, :tflag
17
20
 
@@ -22,11 +25,26 @@ class TC_Controller < Test::Unit::TestCase # :nodoc: all
22
25
  def list
23
26
  @aqflag = true
24
27
  end
28
+
29
+ def another(oid)
30
+ # nop
31
+ end
32
+
33
+ private
34
+
35
+ def encode_myself
36
+ encode_url :list
37
+ end
38
+
39
+ def encode_blog1
40
+ encode_url Blog1Controller, :list
41
+ end
25
42
  end
26
43
 
27
44
  def setup
28
45
  @disp = Dispatcher.new({
29
46
  '/blog' => Blog2Controller,
47
+ '/blog1' => Blog1Controller
30
48
  })
31
49
  @conf = OpenStruct.new
32
50
  @conf.dispatcher = @disp
@@ -47,6 +65,12 @@ class TC_Controller < Test::Unit::TestCase # :nodoc: all
47
65
  # drink
48
66
  end
49
67
 
68
+ assert_equal('/blog/list', c.send(:encode_myself))
69
+ assert_equal('/blog1/list', c.send(:encode_blog1))
70
+
71
+ # handle action with arity.
72
+ assert_equal('/blog/another/32', c.send(:encode_url, :another, :oid, 32))
73
+
50
74
  assert_equal true, c.aqflag
51
75
  assert_equal true, $include1
52
76
  assert_equal true, $include2
@@ -63,4 +87,8 @@ class TC_Controller < Test::Unit::TestCase # :nodoc: all
63
87
  assert Blog2Controller.action_methods.include?('list')
64
88
  end
65
89
 
90
+ def test_encode_decode_methods
91
+
92
+ end
93
+
66
94
  end