raw 0.49.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 (148) hide show
  1. data/doc/CONTRIBUTORS +106 -0
  2. data/doc/LICENSE +32 -0
  3. data/doc/coding_conventions.txt +11 -0
  4. data/lib/raw.rb +42 -0
  5. data/lib/raw/adapter.rb +113 -0
  6. data/lib/raw/adapter/cgi.rb +41 -0
  7. data/lib/raw/adapter/fastcgi.rb +48 -0
  8. data/lib/raw/adapter/mongrel.rb +146 -0
  9. data/lib/raw/adapter/script.rb +94 -0
  10. data/lib/raw/adapter/webrick.rb +144 -0
  11. data/lib/raw/adapter/webrick/vcr.rb +91 -0
  12. data/lib/raw/cgi.rb +323 -0
  13. data/lib/raw/cgi/cookie.rb +47 -0
  14. data/lib/raw/cgi/http.rb +62 -0
  15. data/lib/raw/compiler.rb +138 -0
  16. data/lib/raw/compiler/filter/cleanup.rb +21 -0
  17. data/lib/raw/compiler/filter/elements.rb +166 -0
  18. data/lib/raw/compiler/filter/elements/element.rb +210 -0
  19. data/lib/raw/compiler/filter/localization.rb +23 -0
  20. data/lib/raw/compiler/filter/markup.rb +32 -0
  21. data/lib/raw/compiler/filter/morph.rb +123 -0
  22. data/lib/raw/compiler/filter/morph/each.rb +34 -0
  23. data/lib/raw/compiler/filter/morph/for.rb +11 -0
  24. data/lib/raw/compiler/filter/morph/if.rb +26 -0
  25. data/lib/raw/compiler/filter/morph/selected_if.rb +43 -0
  26. data/lib/raw/compiler/filter/morph/standard.rb +55 -0
  27. data/lib/raw/compiler/filter/morph/times.rb +27 -0
  28. data/lib/raw/compiler/filter/script.rb +116 -0
  29. data/lib/raw/compiler/filter/squeeze.rb +16 -0
  30. data/lib/raw/compiler/filter/static_include.rb +74 -0
  31. data/lib/raw/compiler/filter/template.rb +121 -0
  32. data/lib/raw/compiler/reloader.rb +96 -0
  33. data/lib/raw/context.rb +154 -0
  34. data/lib/raw/context/flash.rb +157 -0
  35. data/lib/raw/context/global.rb +88 -0
  36. data/lib/raw/context/request.rb +338 -0
  37. data/lib/raw/context/response.rb +57 -0
  38. data/lib/raw/context/session.rb +198 -0
  39. data/lib/raw/context/session/drb.rb +11 -0
  40. data/lib/raw/context/session/file.rb +15 -0
  41. data/lib/raw/context/session/memcached.rb +13 -0
  42. data/lib/raw/context/session/memory.rb +12 -0
  43. data/lib/raw/context/session/og.rb +15 -0
  44. data/lib/raw/context/session/pstore.rb +13 -0
  45. data/lib/raw/control.rb +18 -0
  46. data/lib/raw/control/attribute.rb +91 -0
  47. data/lib/raw/control/attribute/checkbox.rb +25 -0
  48. data/lib/raw/control/attribute/datetime.rb +21 -0
  49. data/lib/raw/control/attribute/file.rb +20 -0
  50. data/lib/raw/control/attribute/fixnum.rb +26 -0
  51. data/lib/raw/control/attribute/float.rb +26 -0
  52. data/lib/raw/control/attribute/options.rb +38 -0
  53. data/lib/raw/control/attribute/password.rb +16 -0
  54. data/lib/raw/control/attribute/text.rb +16 -0
  55. data/lib/raw/control/attribute/textarea.rb +16 -0
  56. data/lib/raw/control/none.rb +16 -0
  57. data/lib/raw/control/relation.rb +59 -0
  58. data/lib/raw/control/relation/belongs_to.rb +0 -0
  59. data/lib/raw/control/relation/has_many.rb +97 -0
  60. data/lib/raw/control/relation/joins_many.rb +0 -0
  61. data/lib/raw/control/relation/many_to_many.rb +0 -0
  62. data/lib/raw/control/relation/refers_to.rb +29 -0
  63. data/lib/raw/controller.rb +37 -0
  64. data/lib/raw/controller/publishable.rb +160 -0
  65. data/lib/raw/dispatcher.rb +209 -0
  66. data/lib/raw/dispatcher/format.rb +108 -0
  67. data/lib/raw/dispatcher/format/atom.rb +31 -0
  68. data/lib/raw/dispatcher/format/css.rb +0 -0
  69. data/lib/raw/dispatcher/format/html.rb +42 -0
  70. data/lib/raw/dispatcher/format/json.rb +31 -0
  71. data/lib/raw/dispatcher/format/rss.rb +33 -0
  72. data/lib/raw/dispatcher/format/xoxo.rb +31 -0
  73. data/lib/raw/dispatcher/mounter.rb +60 -0
  74. data/lib/raw/dispatcher/router.rb +111 -0
  75. data/lib/raw/errors.rb +19 -0
  76. data/lib/raw/helper.rb +86 -0
  77. data/lib/raw/helper/benchmark.rb +23 -0
  78. data/lib/raw/helper/buffer.rb +60 -0
  79. data/lib/raw/helper/cookie.rb +32 -0
  80. data/lib/raw/helper/debug.rb +28 -0
  81. data/lib/raw/helper/default.rb +16 -0
  82. data/lib/raw/helper/feed.rb +451 -0
  83. data/lib/raw/helper/form.rb +284 -0
  84. data/lib/raw/helper/javascript.rb +59 -0
  85. data/lib/raw/helper/layout.rb +40 -0
  86. data/lib/raw/helper/navigation.rb +87 -0
  87. data/lib/raw/helper/pager.rb +305 -0
  88. data/lib/raw/helper/table.rb +247 -0
  89. data/lib/raw/helper/xhtml.rb +218 -0
  90. data/lib/raw/helper/xml.rb +125 -0
  91. data/lib/raw/mixin/magick.rb +35 -0
  92. data/lib/raw/mixin/sweeper.rb +71 -0
  93. data/lib/raw/mixin/thumbnails.rb +1 -0
  94. data/lib/raw/mixin/webfile.rb +165 -0
  95. data/lib/raw/render.rb +271 -0
  96. data/lib/raw/render/builder.rb +26 -0
  97. data/lib/raw/render/caching.rb +81 -0
  98. data/lib/raw/render/call.rb +43 -0
  99. data/lib/raw/render/send_file.rb +46 -0
  100. data/lib/raw/render/stream.rb +39 -0
  101. data/lib/raw/scaffold.rb +13 -0
  102. data/lib/raw/scaffold/controller.rb +25 -0
  103. data/lib/raw/scaffold/model.rb +157 -0
  104. data/lib/raw/test.rb +5 -0
  105. data/lib/raw/test/assertions.rb +169 -0
  106. data/lib/raw/test/context.rb +55 -0
  107. data/lib/raw/test/testcase.rb +79 -0
  108. data/lib/raw/util/attr.rb +128 -0
  109. data/lib/raw/util/encode_uri.rb +149 -0
  110. data/lib/raw/util/html_filter.rb +538 -0
  111. data/lib/raw/util/markup.rb +130 -0
  112. data/test/glue/tc_webfile.rb +1 -0
  113. data/test/nitro/CONFIG.rb +3 -0
  114. data/test/nitro/adapter/raw_post1.bin +9 -0
  115. data/test/nitro/adapter/tc_webrick.rb +16 -0
  116. data/test/nitro/cgi/tc_cookie.rb +14 -0
  117. data/test/nitro/cgi/tc_request.rb +61 -0
  118. data/test/nitro/compiler/tc_client_morpher.rb +47 -0
  119. data/test/nitro/compiler/tc_compiler.rb +25 -0
  120. data/test/nitro/dispatcher/tc_mounter.rb +47 -0
  121. data/test/nitro/helper/tc_feed.rb +135 -0
  122. data/test/nitro/helper/tc_navbar.rb +74 -0
  123. data/test/nitro/helper/tc_pager.rb +35 -0
  124. data/test/nitro/helper/tc_table.rb +68 -0
  125. data/test/nitro/helper/tc_xhtml.rb +19 -0
  126. data/test/nitro/tc_caching.rb +19 -0
  127. data/test/nitro/tc_cgi.rb +222 -0
  128. data/test/nitro/tc_context.rb +17 -0
  129. data/test/nitro/tc_controller.rb +103 -0
  130. data/test/nitro/tc_controller_aspect.rb +32 -0
  131. data/test/nitro/tc_controller_params.rb +885 -0
  132. data/test/nitro/tc_dispatcher.rb +109 -0
  133. data/test/nitro/tc_element.rb +85 -0
  134. data/test/nitro/tc_flash.rb +59 -0
  135. data/test/nitro/tc_helper.rb +47 -0
  136. data/test/nitro/tc_render.rb +119 -0
  137. data/test/nitro/tc_router.rb +61 -0
  138. data/test/nitro/tc_server.rb +35 -0
  139. data/test/nitro/tc_session.rb +66 -0
  140. data/test/nitro/tc_template.rb +71 -0
  141. data/test/nitro/util/tc_encode_url.rb +87 -0
  142. data/test/nitro/util/tc_markup.rb +31 -0
  143. data/test/public/blog/another/very_litle/index.xhtml +1 -0
  144. data/test/public/blog/inc1.xhtml +2 -0
  145. data/test/public/blog/inc2.xhtml +1 -0
  146. data/test/public/blog/list.xhtml +9 -0
  147. data/test/public/dummy_mailer/registration.xhtml +5 -0
  148. metadata +244 -0
@@ -0,0 +1,109 @@
1
+ require File.join(File.dirname(__FILE__), 'CONFIG.rb')
2
+
3
+ require 'test/unit'
4
+
5
+ require 'nitro/dispatcher'
6
+
7
+ class TC_Dispatcher < Test::Unit::TestCase # :nodoc: all
8
+ include Nitro
9
+
10
+ class Link
11
+ end
12
+
13
+ class Link::Comment
14
+ end
15
+
16
+ class Link::Controller
17
+ def index
18
+ end
19
+
20
+ def delete(oid)
21
+ end
22
+
23
+ def update(oid)
24
+ end
25
+
26
+ def create
27
+ end
28
+
29
+ def self.respond_to_action_or_template?(a)
30
+ instance_methods.include?(a)
31
+ end
32
+ end
33
+
34
+ class Link::Comment::Controller
35
+ def self.respond_to_action_or_template?(a)
36
+ instance_methods.include?(a)
37
+ end
38
+ end
39
+
40
+ class RootController
41
+ def index
42
+ end
43
+
44
+ def feed(category)
45
+ end
46
+
47
+ def self.respond_to_action_or_template?(a)
48
+ instance_methods.include?(a)
49
+ end
50
+ end
51
+
52
+ Template.root = File.expand_path(File.join('..', 'public'))
53
+
54
+ def setup
55
+ @d = Dispatcher.new
56
+
57
+ @d['/'] = RootController
58
+ @d['/links'] = Link::Controller
59
+ @d['/links/comments'] = Link::Comment::Controller
60
+ end
61
+
62
+ def teardown
63
+ @d = nil
64
+ end
65
+
66
+ def test_initialize
67
+ dis = Dispatcher.new(RootController)
68
+ assert_equal RootController, dis['/']
69
+ end
70
+
71
+ def test_dispatch
72
+ r = [Link::Controller, "index_action", "category=1", [], ".html"]
73
+ assert_equal r, @d.dispatch('/links/index.html?category=1')
74
+
75
+ r = [RootController, "feed_action", nil, ["world"], ""]
76
+ assert_equal r, @d.dispatch('/feed/world')
77
+
78
+ r = [RootController, "feed_action", nil, ["zuper", "duper", "world"], ".xml"]
79
+ assert_equal r, @d.dispatch('/feed/zuper/duper/world.xml')
80
+
81
+ r = [RootController, "feed_action", "oid=2;test=1", ["zuper", "duper", "world"], ".xml"]
82
+ assert_equal r, @d.dispatch('/feed/zuper/duper/world.xml?oid=2;test=1')
83
+
84
+ r = [Link::Controller, "delete_action", nil, ["1"], ""]
85
+ assert_equal r, @d.dispatch('/tralala?oid=1') rescue nil
86
+
87
+ r = [Link::Controller, "delete_action", nil, ["1"], ""]
88
+ assert_equal r, @d.dispatch('/links/1', :delete)
89
+
90
+ r = [Link::Controller, "update_action", nil, ["1"], ""]
91
+ assert_equal r, @d.dispatch('/links/1', :put)
92
+
93
+ r = [Link::Controller, "index_action", nil, [], ""]
94
+ assert_equal r, @d.dispatch('/links', :get)
95
+
96
+ r = [Link::Controller, "index_action", nil, [], ".xml"]
97
+ assert_equal r, @d.dispatch('/links/index.xml', :get)
98
+
99
+ r = [Link::Controller, "create_action", nil, [], ""]
100
+ assert_equal r, @d.dispatch('/links', :post)
101
+
102
+ r = [Link::Controller, "create_action", "great=2;stuff=1", [], ""]
103
+ assert_equal r, @d.dispatch('/links?great=2;stuff=1', :post)
104
+
105
+ r = [RootController, "index_action", nil, [], ""]
106
+ assert_equal r, @d.dispatch('/')
107
+ end
108
+
109
+ end
@@ -0,0 +1,85 @@
1
+ require File.join(File.dirname(__FILE__), 'CONFIG.rb')
2
+
3
+ require 'test/unit'
4
+
5
+ require 'glue'
6
+ require 'nitro/compiler/elements'
7
+
8
+ include Nitro
9
+
10
+ $source = %{
11
+ <html>
12
+ <?r a = 5 ?>
13
+ Here is some text
14
+ <body style="hidden" name="1">
15
+ Some more
16
+ <Box color="#f00">
17
+ Hello World
18
+ <Box color="#ff0">
19
+ <b>nice</b>
20
+ <i>stuff</i>
21
+ <Box color="#fff">
22
+ It works
23
+ </Box>
24
+ </Box>
25
+ Text
26
+ </Box>
27
+ The End
28
+ </body>
29
+ </html>
30
+ }
31
+
32
+ $source2 = %{
33
+ <x:box color="#ff0">
34
+ xhtml mode
35
+ </x:box>
36
+ }
37
+
38
+ $source3 = %{
39
+ <Page>
40
+ <Box>Hello</Box>
41
+ <Box>World</Box>
42
+ <Bar>Foo</Bar>
43
+ </Page>
44
+ }
45
+
46
+ class Page < Nitro::Element
47
+ def render
48
+ %~
49
+ <html id="2">
50
+ #{content}
51
+ #{content :bar}
52
+ </html>
53
+ ~
54
+ end
55
+ end
56
+
57
+ class Box < Nitro::Element
58
+ def open
59
+ %|<div style="color: #@color">|
60
+ end
61
+
62
+ def close
63
+ "</div>"
64
+ end
65
+ end
66
+
67
+ class Bar < Nitro::Element
68
+ def render
69
+ %~
70
+ This is a great #{content}.
71
+ ~
72
+ end
73
+ end
74
+
75
+ class TC_Element < Test::Unit::TestCase # :nodoc: all
76
+ def test_all
77
+ compiler_mock = Struct.new(:controller).new
78
+
79
+ res = ElementCompiler.transform($source, compiler_mock)
80
+ assert_match /div style/, res
81
+ res = ElementCompiler.transform($source2, compiler_mock)
82
+ assert_match /div style/, res
83
+ res = ElementCompiler.transform($source3, compiler_mock)
84
+ end
85
+ end
@@ -0,0 +1,59 @@
1
+ require File.join(File.dirname(__FILE__), 'CONFIG.rb')
2
+
3
+ require 'test/unit'
4
+ require 'ostruct'
5
+
6
+ require 'nitro'
7
+ require 'nitro/controller'
8
+ require 'nitro/flash'
9
+
10
+ class TC_Flash < Test::Unit::TestCase # :nodoc: all
11
+ include Nitro
12
+
13
+ class MyController < Controller
14
+ attr_accessor :flag
15
+
16
+ def action1
17
+ flash[:msg] = 'Hello world!'
18
+ end
19
+
20
+ def action2
21
+ @flag = flash[:msg]
22
+ end
23
+ end
24
+
25
+ def setup
26
+ @conf = OpenStruct.new
27
+ end
28
+
29
+ def teardown
30
+ @conf = nil
31
+ end
32
+
33
+ def test_all
34
+ ctx = Context.new(@conf)
35
+ ctx.headers = {}
36
+ ctx.params = {}
37
+ ctx.instance_eval '@session = {}'
38
+ c = MyController.new(ctx)
39
+ c.action1
40
+ c.action2
41
+ assert_equal 'Hello world!', c.flag
42
+ c.action2
43
+ assert_equal 'Hello world!', c.flag
44
+ end
45
+
46
+ def test_push
47
+ f = Flashing::Flash.new
48
+ f.push :errors, 'Error 1'
49
+ f.push :errors, 'Error 2'
50
+
51
+ assert_equal 2, f[:errors].size
52
+
53
+ f.push :errors, 'Error 3'
54
+
55
+ assert_equal 3, f[:errors].size
56
+
57
+ assert_equal 'Error 3', f[:errors].pop
58
+ end
59
+ end
@@ -0,0 +1,47 @@
1
+ require File.join(File.dirname(__FILE__), 'CONFIG.rb')
2
+
3
+ require 'test/unit'
4
+ require 'ostruct'
5
+
6
+ require 'nitro/helper'
7
+
8
+ class Base
9
+ include Nitro::Helpers
10
+ end
11
+
12
+ module MyHelper
13
+ def hello_world
14
+ return 5
15
+ end
16
+ end
17
+
18
+ module AnotherHelper
19
+ def bye_world
20
+ return 0
21
+ end
22
+ end
23
+
24
+ module Funny
25
+ def funny_world
26
+ return 1
27
+ end
28
+ end
29
+
30
+ class MyBase < Base
31
+ helper :my
32
+ helper AnotherHelper
33
+ end
34
+
35
+ class TC_Helper < Test::Unit::TestCase # :nodoc: all
36
+ def test_all
37
+ assert !MyBase.public_instance_methods.include?('hello_world')
38
+ assert MyBase.private_instance_methods.include?('hello_world')
39
+ assert !MyBase.public_instance_methods.include?('bye_world')
40
+ assert MyBase.private_instance_methods.include?('bye_world')
41
+
42
+ # test a bug.
43
+ MyBase.helper(Funny)
44
+ assert !MyBase.public_instance_methods.include?('funny_world')
45
+ assert MyBase.private_instance_methods.include?('funny_world')
46
+ end
47
+ end
@@ -0,0 +1,119 @@
1
+ require File.join(File.dirname(__FILE__), 'CONFIG.rb')
2
+
3
+ require 'test/unit'
4
+
5
+ require 'nitro'
6
+ require 'nitro/render'
7
+ require 'nitro/session'
8
+ require 'nitro/context'
9
+ require 'facets/more/mock'
10
+
11
+ class TestRender < Test::Unit::TestCase # :nodoc: all
12
+ include Nitro
13
+
14
+ class ContextMock < Mock
15
+ mock :response_headers, {}
16
+ mock :host_url, 'http://www.nitroproject.org'
17
+ end
18
+
19
+ class TestController < Controller
20
+ end
21
+
22
+ class CallController < Controller
23
+ def return_session
24
+ session[:CALL_STACK].inspect
25
+ end
26
+
27
+ def needs_login
28
+ call "login"
29
+ end
30
+
31
+ def login
32
+ answer()
33
+ end
34
+ end
35
+
36
+ @@session = Session.new
37
+ def handle_request(url, value)
38
+ conf = OpenStruct.new
39
+ disp = Nitro::Dispatcher.new('/' => CallController)
40
+ conf.dispatcher = disp
41
+ @ctx = Nitro::Context.new(conf)
42
+ @ctx.headers = { 'REQUEST_METHOD' => 'GET' }
43
+ @ctx.params = {}
44
+ @ctx.instance_variable_set '@session', @@session
45
+
46
+ if value[:in]
47
+ @ctx.in = value.delete(:in)
48
+ @ctx.headers['CONTENT_LENGTH'] = value.delete(:in_size) || @ctx.in.size
49
+ end
50
+
51
+ if value[:method]
52
+ @ctx.headers['REQUEST_METHOD'] = value[:method].to_s
53
+ end
54
+
55
+ if value['CONTENT_TYPE']
56
+ @ctx.headers['CONTENT_TYPE'] = value.delete('CONTENT_TYPE')
57
+ end
58
+
59
+ @ctx.headers['REQUEST_URI'] = url
60
+
61
+ if (!@ctx.query_string || @ctx.query_string.empty?) and @ctx.uri =~ /\?/
62
+ @ctx.headers['QUERY_STRING'] = @ctx.uri.split('?').last
63
+ end
64
+
65
+ Nitro::Cgi.parse_params(@ctx)
66
+ Nitro::Cgi.parse_cookies(@ctx)
67
+
68
+ @ctx.render url
69
+
70
+ #retrieve the stuff from @out again as a hash
71
+ result = @ctx.out
72
+
73
+ return result
74
+ end
75
+
76
+ def setup
77
+ ctx = ContextMock.new
78
+ @controller = TestController.new(ctx)
79
+ end
80
+
81
+ def teardown
82
+ @controller = nil
83
+ end
84
+
85
+ def test_redirect
86
+ # relative url, the controller base_url is prepended (uh, really?)
87
+ redirect 'hello'
88
+ assert_equal 'http://www.nitroproject.org/hello', @controller.context.response_headers['location']
89
+
90
+ # absolute url, use as is.
91
+ redirect '/main'
92
+ assert_equal 'http://www.nitroproject.org/main', @controller.context.response_headers['location']
93
+
94
+ # http://, use as is.
95
+ redirect 'http://www.gmosx.com/info'
96
+ assert_equal 'http://www.gmosx.com/info', @controller.context.response_headers['location']
97
+
98
+ redirect 'edit/Home'
99
+ assert_equal 'http://www.nitroproject.org/edit/Home', @controller.context.response_headers['location']
100
+
101
+ redirect '/edit/Home'
102
+ assert_equal 'http://www.nitroproject.org/edit/Home', @controller.context.response_headers['location']
103
+ end
104
+
105
+ def redirect(*args)
106
+ begin
107
+ @controller.send :redirect, *args
108
+ rescue Nitro::RenderExit
109
+ end
110
+ end
111
+
112
+ def test_call
113
+ handle_request('/needs_login', {})
114
+ assert_equal ['/needs_login'], eval(handle_request('/return_session', {}))
115
+ handle_request('/login', {})
116
+ assert_equal [], eval(handle_request('/return_session', {}))
117
+ end
118
+
119
+ end
@@ -0,0 +1,61 @@
1
+ require File.join(File.dirname(__FILE__), 'CONFIG.rb')
2
+
3
+ require 'test/unit'
4
+ require 'ostruct'
5
+
6
+ require 'nitro/dispatcher/router'
7
+
8
+ class IdController; end
9
+ class AdminController; end
10
+
11
+ class AbstractRouter
12
+ include Nitro::Router
13
+
14
+ def initialize
15
+ init_routes()
16
+ end
17
+ end
18
+
19
+ class TC_Router < Test::Unit::TestCase # :nodoc: all
20
+ include Nitro
21
+
22
+ def setup
23
+ @r = AbstractRouter.new
24
+
25
+ @r.add_rule(:match => %r{rewritten/url/(.*)}, :controller => IdController, :action => :register, :param => :name)
26
+ @r.add_rule(:match => %r{another/zelo/(.*)/(.*)}, :controller => AdminController, :action => :kick, :params => [:name, :age])
27
+ @r.add_rule(:match => %r{cool/(.*)_(.*).html}, :controller => AdminController, :action => :long, :params => [:name, :age])
28
+ end
29
+
30
+ def teardown
31
+ @r = nil
32
+ end
33
+
34
+ def test_decode
35
+ c, a, params = @r.decode_route('rewritten/url/gmosx')
36
+ assert_equal IdController, c
37
+ assert_equal :register, a
38
+ assert_equal 'gmosx', params['name']
39
+
40
+ c, a, params = @r.decode_route('another/zelo/gmosx/32')
41
+ assert_equal AdminController, c
42
+ assert_equal :kick, a
43
+ assert_equal 'gmosx', params['name']
44
+ assert_equal '32', params['age']
45
+
46
+ c, a, params = @r.decode_route('cool/gmosx_32.html')
47
+ assert_equal AdminController, c
48
+ assert_equal :long, a
49
+ assert_equal 'gmosx', params['name']
50
+ assert_equal '32', params['age']
51
+
52
+ assert_equal false, @r.decode_route('this/doesnt/decode')
53
+ end
54
+
55
+ def test_encode
56
+ assert_equal 'rewritten/url/gmosx', @r.encode_route(IdController, :register, :name, 'gmosx')
57
+ assert_equal 'cool/gmosx_32.html', @r.encode_route(AdminController, :long, :name, 'gmosx', :age, 32)
58
+ assert_equal false, @r.encode_route(AdminController, :invalid, :gender, 'male')
59
+ end
60
+
61
+ end