actionpack 1.5.1 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionpack might be problematic. Click here for more details.

Files changed (39) hide show
  1. data/CHANGELOG +94 -0
  2. data/README +24 -0
  3. data/lib/action_controller.rb +2 -0
  4. data/lib/action_controller/assertions/action_pack_assertions.rb +1 -1
  5. data/lib/action_controller/base.rb +15 -2
  6. data/lib/action_controller/caching.rb +6 -16
  7. data/lib/action_controller/components.rb +1 -1
  8. data/lib/action_controller/flash.rb +125 -29
  9. data/lib/action_controller/pagination.rb +378 -0
  10. data/lib/action_controller/request.rb +13 -6
  11. data/lib/action_controller/routing.rb +37 -3
  12. data/lib/action_controller/test_process.rb +7 -3
  13. data/lib/action_controller/url_rewriter.rb +5 -4
  14. data/lib/action_view/helpers/asset_tag_helper.rb +35 -4
  15. data/lib/action_view/helpers/capture_helper.rb +95 -0
  16. data/lib/action_view/helpers/form_helper.rb +1 -1
  17. data/lib/action_view/helpers/form_options_helper.rb +2 -0
  18. data/lib/action_view/helpers/form_tag_helper.rb +28 -10
  19. data/lib/action_view/helpers/javascript_helper.rb +192 -0
  20. data/lib/action_view/helpers/javascripts/prototype.js +336 -0
  21. data/lib/action_view/helpers/pagination_helper.rb +71 -0
  22. data/lib/action_view/helpers/tag_helper.rb +2 -1
  23. data/lib/action_view/helpers/text_helper.rb +15 -2
  24. data/lib/action_view/helpers/url_helper.rb +3 -20
  25. data/lib/action_view/partials.rb +4 -2
  26. data/rakefile +2 -2
  27. data/test/controller/action_pack_assertions_test.rb +1 -2
  28. data/test/controller/flash_test.rb +30 -5
  29. data/test/controller/request_test.rb +33 -10
  30. data/test/controller/routing_tests.rb +26 -0
  31. data/test/template/asset_tag_helper_test.rb +87 -2
  32. data/test/template/form_helper_test.rb +1 -0
  33. data/test/template/form_options_helper_test.rb +11 -0
  34. data/test/template/form_tag_helper_test.rb +84 -16
  35. data/test/template/tag_helper_test.rb +2 -15
  36. data/test/template/text_helper_test.rb +6 -0
  37. data/test/template/url_helper_test.rb +13 -18
  38. metadata +10 -5
  39. data/test/controller/url_obsolete.rb.rej +0 -747
@@ -1,4 +1,5 @@
1
- require 'test/unit'
1
+ require File.dirname(__FILE__) + '/../abstract_unit'
2
+
2
3
  require File.dirname(__FILE__) + '/../../lib/action_view/helpers/tag_helper'
3
4
  require File.dirname(__FILE__) + '/../../lib/action_view/helpers/url_helper'
4
5
 
@@ -16,18 +17,4 @@ class TagHelperTest < Test::Unit::TestCase
16
17
  assert_equal content_tag("a", "Create", "href" => "create"),
17
18
  content_tag("a", "Create", :href => "create")
18
19
  end
19
-
20
- def test_mail_to_with_javascript
21
- assert_equal "<script type=\"text/javascript\" language=\"javascript\">eval(unescape('%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%22%3e%4d%79%20%65%6d%61%69%6c%3c%2f%61%3e%27%29%3b'))</script>", mail_to("me@domain.com", "My email", :encode => "javascript")
22
- end
23
-
24
- def test_mail_to_with_hex
25
- assert_equal "<a href=\"mailto:%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d\">My email</a>", mail_to("me@domain.com", "My email", :encode => "hex")
26
- end
27
-
28
- def test_mail_to
29
- assert_equal "<a href=\"mailto:me@domain.com\">My email</a>", mail_to("me@domain.com", "My email")
30
- end
31
-
32
- # FIXME: Test form tag
33
20
  end
@@ -3,6 +3,12 @@ require File.dirname(__FILE__) + '/../../lib/action_view/helpers/text_helper'
3
3
 
4
4
  class TextHelperTest < Test::Unit::TestCase
5
5
  include ActionView::Helpers::TextHelper
6
+
7
+ def test_simple_format
8
+ assert_equal "<p>crazy\n<br /> cross\n<br /> platform linebreaks</p>", simple_format("crazy\r\n cross\r platform linebreaks")
9
+ assert_equal "<p>A paragraph</p>\n\n<p>and another one!</p>", simple_format("A paragraph\n\nand another one!")
10
+ assert_equal "<p>A paragraph\n<br /> With a newline</p>", simple_format("A paragraph\n With a newline")
11
+ end
6
12
 
7
13
  def test_truncate
8
14
  assert_equal "Hello World!", truncate("Hello World!", 12)
@@ -1,10 +1,13 @@
1
- require 'test/unit'
1
+ require File.dirname(__FILE__) + '/../abstract_unit'
2
+
2
3
  require File.dirname(__FILE__) + '/../../lib/action_view/helpers/url_helper'
4
+ require File.dirname(__FILE__) + '/../../lib/action_view/helpers/asset_tag_helper'
3
5
  require File.dirname(__FILE__) + '/../../lib/action_view/helpers/tag_helper'
4
6
 
5
7
  RequestMock = Struct.new("Request", :request_uri)
6
8
 
7
9
  class UrlHelperTest < Test::Unit::TestCase
10
+ include ActionView::Helpers::AssetTagHelper
8
11
  include ActionView::Helpers::UrlHelper
9
12
  include ActionView::Helpers::TagHelper
10
13
 
@@ -33,23 +36,6 @@ class UrlHelperTest < Test::Unit::TestCase
33
36
  )
34
37
  end
35
38
 
36
- def test_link_image_to
37
- assert_equal(
38
- "<a href=\"http://www.example.com\"><img alt=\"Rss\" border=\"0\" height=\"45\" src=\"/images/rss.png\" width=\"30\" /></a>",
39
- link_image_to("rss", "http://www.example.com", "size" => "30x45", "border" => "0")
40
- )
41
-
42
- assert_equal(
43
- "<a class=\"admin\" href=\"http://www.example.com\"><img alt=\"Feed\" height=\"45\" src=\"/images/rss.gif\" width=\"30\" /></a>",
44
- link_image_to("rss.gif", "http://www.example.com", "size" => "30x45", "alt" => "Feed", "class" => "admin")
45
- )
46
-
47
- assert_equal link_image_to("rss", "http://www.example.com", "size" => "30x45"),
48
- link_image_to("rss", "http://www.example.com", :size => "30x45")
49
- assert_equal link_image_to("rss.gif", "http://www.example.com", "size" => "30x45", "alt" => "Feed", "class" => "admin"),
50
- link_image_to("rss.gif", "http://www.example.com", :size => "30x45", :alt => "Feed", :class => "admin")
51
- end
52
-
53
39
  def test_link_to_unless
54
40
  assert_equal "Showing", link_to_unless(true, "Showing", :action => "show", :controller => "weblog")
55
41
  assert "<a href=\"http://www.example.com\">Listing</a>", link_to_unless(false, "Listing", :action => "list", :controller => "weblog")
@@ -93,6 +79,15 @@ class UrlHelperTest < Test::Unit::TestCase
93
79
  mail_to("david@loudthinking.com", "David Heinemeier Hansson", :class => "admin")
94
80
  end
95
81
 
82
+
83
+ def test_mail_to_with_javascript
84
+ assert_equal "<script type=\"text/javascript\" language=\"javascript\">eval(unescape('%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%22%3e%4d%79%20%65%6d%61%69%6c%3c%2f%61%3e%27%29%3b'))</script>", mail_to("me@domain.com", "My email", :encode => "javascript")
85
+ end
86
+
87
+ def test_mail_to_with_hex
88
+ assert_equal "<a href=\"mailto:%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d\">My email</a>", mail_to("me@domain.com", "My email", :encode => "hex")
89
+ end
90
+
96
91
  def test_link_with_nil_html_options
97
92
  assert_equal "<a href=\"http://www.example.com\">Hello</a>", link_to("Hello", {:action => 'myaction'}, nil)
98
93
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.6
2
+ rubygems_version: 0.8.8
3
3
  specification_version: 1
4
4
  name: actionpack
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.5.1
7
- date: 2005-03-07
6
+ version: 1.6.0
7
+ date: 2005-03-22
8
8
  summary: Web-flow and rendering framework putting the VC in MVC.
9
9
  require_paths:
10
10
  - lib
@@ -53,6 +53,7 @@ files:
53
53
  - lib/action_controller/flash.rb
54
54
  - lib/action_controller/helpers.rb
55
55
  - lib/action_controller/layout.rb
56
+ - lib/action_controller/pagination.rb
56
57
  - lib/action_controller/request.rb
57
58
  - lib/action_controller/rescue.rb
58
59
  - lib/action_controller/response.rb
@@ -95,14 +96,19 @@ files:
95
96
  - lib/action_view/helpers/active_record_helper.rb
96
97
  - lib/action_view/helpers/asset_tag_helper.rb
97
98
  - lib/action_view/helpers/cache_helper.rb
99
+ - lib/action_view/helpers/capture_helper.rb
98
100
  - lib/action_view/helpers/date_helper.rb
99
101
  - lib/action_view/helpers/debug_helper.rb
100
102
  - lib/action_view/helpers/form_helper.rb
101
103
  - lib/action_view/helpers/form_options_helper.rb
102
104
  - lib/action_view/helpers/form_tag_helper.rb
105
+ - lib/action_view/helpers/javascript_helper.rb
106
+ - lib/action_view/helpers/javascripts
107
+ - lib/action_view/helpers/pagination_helper.rb
103
108
  - lib/action_view/helpers/tag_helper.rb
104
109
  - lib/action_view/helpers/text_helper.rb
105
110
  - lib/action_view/helpers/url_helper.rb
111
+ - lib/action_view/helpers/javascripts/prototype.js
106
112
  - lib/action_view/vendor/builder
107
113
  - lib/action_view/vendor/builder.rb
108
114
  - lib/action_view/vendor/builder/blankslate.rb
@@ -131,7 +137,6 @@ files:
131
137
  - test/controller/routing_tests.rb
132
138
  - test/controller/send_file_test.rb
133
139
  - test/controller/url_obsolete.rb
134
- - test/controller/url_obsolete.rb.rej
135
140
  - test/fixtures/fun
136
141
  - test/fixtures/helpers
137
142
  - test/fixtures/layouts
@@ -192,5 +197,5 @@ dependencies:
192
197
  -
193
198
  - "="
194
199
  - !ruby/object:Gem::Version
195
- version: 1.0.1
200
+ version: 1.0.2
196
201
  version:
@@ -1,747 +0,0 @@
1
- ***************
2
- *** 35,41 ****
3
- def setup
4
- @library_url = ActionController::UrlRewriter.old_new(MockRequest.new(
5
- &#34;http://&#34;,
6
- - &#34;www.singlefile.com&#34;,
7
- 80,
8
- &#34;/library/books/ISBN/0743536703/show&#34;,
9
- { &#34;type&#34; =&gt; &#34;ISBN&#34;, &#34;code&#34; =&gt; &#34;0743536703&#34; }
10
- --- 35,41 ----
11
- def setup
12
- @library_url = ActionController::UrlRewriter.old_new(MockRequest.new(
13
- &#34;http://&#34;,
14
- + &#34;www.example.com&#34;,
15
- 80,
16
- &#34;/library/books/ISBN/0743536703/show&#34;,
17
- { &#34;type&#34; =&gt; &#34;ISBN&#34;, &#34;code&#34; =&gt; &#34;0743536703&#34; }
18
- ***************
19
- *** 43,49 ****
20
-
21
- @library_url_using_module = ActionController::UrlRewriter.old_new(MockRequest.new(
22
- &#34;http://&#34;,
23
- - &#34;www.singlefile.com&#34;,
24
- 80,
25
- &#34;/library/books/ISBN/0743536703/show&#34;,
26
- { &#34;type&#34; =&gt; &#34;ISBN&#34;, &#34;code&#34; =&gt; &#34;0743536703&#34;, &#34;module&#34; =&gt; &#34;library&#34; }
27
- --- 43,49 ----
28
-
29
- @library_url_using_module = ActionController::UrlRewriter.old_new(MockRequest.new(
30
- &#34;http://&#34;,
31
- + &#34;www.example.com&#34;,
32
- 80,
33
- &#34;/library/books/ISBN/0743536703/show&#34;,
34
- { &#34;type&#34; =&gt; &#34;ISBN&#34;, &#34;code&#34; =&gt; &#34;0743536703&#34;, &#34;module&#34; =&gt; &#34;library&#34; }
35
- ***************
36
- *** 51,57 ****
37
-
38
- @library_url_on_index = ActionController::UrlRewriter.old_new(MockRequest.new(
39
- &#34;http://&#34;,
40
- - &#34;www.singlefile.com&#34;,
41
- 80,
42
- &#34;/library/books/ISBN/0743536703/&#34;,
43
- { &#34;type&#34; =&gt; &#34;ISBN&#34;, &#34;code&#34; =&gt; &#34;0743536703&#34; }
44
- --- 51,57 ----
45
-
46
- @library_url_on_index = ActionController::UrlRewriter.old_new(MockRequest.new(
47
- &#34;http://&#34;,
48
- + &#34;www.example.com&#34;,
49
- 80,
50
- &#34;/library/books/ISBN/0743536703/&#34;,
51
- { &#34;type&#34; =&gt; &#34;ISBN&#34;, &#34;code&#34; =&gt; &#34;0743536703&#34; }
52
- ***************
53
- *** 59,103 ****
54
-
55
- @clean_urls = [
56
- ActionController::UrlRewriter.old_new(MockRequest.new(
57
- - &#34;http://&#34;, &#34;www.singlefile.com&#34;, 80, &#34;/identity/&#34;, {}
58
- ), &#34;identity&#34;, &#34;index&#34;),
59
- ActionController::UrlRewriter.old_new(MockRequest.new(
60
- - &#34;http://&#34;, &#34;www.singlefile.com&#34;, 80, &#34;/identity&#34;, {}
61
- ), &#34;identity&#34;, &#34;index&#34;)
62
- ]
63
-
64
- @clean_url_with_id = ActionController::UrlRewriter.old_new(MockRequest.new(
65
- - &#34;http://&#34;, &#34;www.singlefile.com&#34;, 80, &#34;/identity/show/5&#34;, { &#34;id&#34; =&gt; &#34;5&#34; }
66
- ), &#34;identity&#34;, &#34;show&#34;)
67
-
68
- @clean_url_with_same_action_and_controller_name = ActionController::UrlRewriter.old_new(MockRequest.new(
69
- - &#34;http://&#34;, &#34;www.singlefile.com&#34;, 80, &#34;/login/login&#34;, { }
70
- ), &#34;login&#34;, &#34;login&#34;)
71
-
72
- @clean_url_with_same_action_and_controller_and_module_name = ActionController::UrlRewriter.old_new(MockRequest.new(
73
- - &#34;http://&#34;, &#34;www.singlefile.com&#34;, 80, &#34;/login/login/login&#34;, { &#34;module&#34; =&gt; &#34;login&#34; }
74
- ), &#34;login&#34;, &#34;login&#34;)
75
-
76
- @clean_url_with_id_as_char = ActionController::UrlRewriter.old_new(MockRequest.new(
77
- - &#34;http://&#34;, &#34;www.singlefile.com&#34;, 80, &#34;/teachers/show/t&#34;, { &#34;id&#34; =&gt; &#34;t&#34; }
78
- ), &#34;teachers&#34;, &#34;show&#34;)
79
- end
80
-
81
- def test_clean_action
82
- - assert_equal &#34;http://www.singlefile.com/library/books/ISBN/0743536703/edit&#34;, @library_url.rewrite(:action =&gt; &#34;edit&#34;)
83
- end
84
-
85
- def test_clean_action_to_another_host
86
- assert_equal(
87
- - &#34;http://www.booksphere.com/library/books/ISBN/0743536703/edit&#34;,
88
- - @library_url.rewrite(:action =&gt; &#34;edit&#34;, :host =&gt; &#34;www.booksphere.com&#34;)
89
- )
90
- end
91
-
92
- def test_clean_action_to_another_host_and_protocol
93
- assert_equal(
94
- - &#34;https://www.booksphere.com/library/books/ISBN/0743536703/edit&#34;,
95
- - @library_url.rewrite(:action =&gt; &#34;edit&#34;, :host =&gt; &#34;www.booksphere.com&#34;, :protocol =&gt; &#34;https://&#34;)
96
- )
97
- end
98
-
99
- --- 59,103 ----
100
-
101
- @clean_urls = [
102
- ActionController::UrlRewriter.old_new(MockRequest.new(
103
- + &#34;http://&#34;, &#34;www.example.com&#34;, 80, &#34;/identity/&#34;, {}
104
- ), &#34;identity&#34;, &#34;index&#34;),
105
- ActionController::UrlRewriter.old_new(MockRequest.new(
106
- + &#34;http://&#34;, &#34;www.example.com&#34;, 80, &#34;/identity&#34;, {}
107
- ), &#34;identity&#34;, &#34;index&#34;)
108
- ]
109
-
110
- @clean_url_with_id = ActionController::UrlRewriter.old_new(MockRequest.new(
111
- + &#34;http://&#34;, &#34;www.example.com&#34;, 80, &#34;/identity/show/5&#34;, { &#34;id&#34; =&gt; &#34;5&#34; }
112
- ), &#34;identity&#34;, &#34;show&#34;)
113
-
114
- @clean_url_with_same_action_and_controller_name = ActionController::UrlRewriter.old_new(MockRequest.new(
115
- + &#34;http://&#34;, &#34;www.example.com&#34;, 80, &#34;/login/login&#34;, { }
116
- ), &#34;login&#34;, &#34;login&#34;)
117
-
118
- @clean_url_with_same_action_and_controller_and_module_name = ActionController::UrlRewriter.old_new(MockRequest.new(
119
- + &#34;http://&#34;, &#34;www.example.com&#34;, 80, &#34;/login/login/login&#34;, { &#34;module&#34; =&gt; &#34;login&#34; }
120
- ), &#34;login&#34;, &#34;login&#34;)
121
-
122
- @clean_url_with_id_as_char = ActionController::UrlRewriter.old_new(MockRequest.new(
123
- + &#34;http://&#34;, &#34;www.example.com&#34;, 80, &#34;/teachers/show/t&#34;, { &#34;id&#34; =&gt; &#34;t&#34; }
124
- ), &#34;teachers&#34;, &#34;show&#34;)
125
- end
126
-
127
- def test_clean_action
128
- + assert_equal &#34;http://www.example.com/library/books/ISBN/0743536703/edit&#34;, @library_url.rewrite(:action =&gt; &#34;edit&#34;)
129
- end
130
-
131
- def test_clean_action_to_another_host
132
- assert_equal(
133
- + &#34;http://www.example.com/library/books/ISBN/0743536703/edit&#34;,
134
- + @library_url.rewrite(:action =&gt; &#34;edit&#34;, :host =&gt; &#34;www.example.com&#34;)
135
- )
136
- end
137
-
138
- def test_clean_action_to_another_host_and_protocol
139
- assert_equal(
140
- + &#34;https://www.example.com/library/books/ISBN/0743536703/edit&#34;,
141
- + @library_url.rewrite(:action =&gt; &#34;edit&#34;, :host =&gt; &#34;www.example.com&#34;, :protocol =&gt; &#34;https://&#34;)
142
- )
143
- end
144
-
145
- ***************
146
- *** 106,246 ****
147
- end
148
-
149
- def test_action_from_index
150
- - assert_equal &#34;http://www.singlefile.com/library/books/ISBN/0743536703/edit&#34;, @library_url_on_index.rewrite(:action =&gt; &#34;edit&#34;)
151
- end
152
-
153
- def test_action_from_index_on_clean
154
- @clean_urls.each do |url|
155
- - assert_equal &#34;http://www.singlefile.com/identity/edit&#34;, url.rewrite(:action =&gt; &#34;edit&#34;)
156
- end
157
- end
158
-
159
- def test_action_without_prefix
160
- - assert_equal &#34;http://www.singlefile.com/library/books/&#34;, @library_url.rewrite(:action =&gt; &#34;index&#34;, :action_prefix =&gt; &#34;&#34;)
161
- end
162
-
163
- def test_action_with_prefix
164
- assert_equal(
165
- - &#34;http://www.singlefile.com/library/books/XTC/123/show&#34;,
166
- @library_url.rewrite(:action =&gt; &#34;show&#34;, :action_prefix =&gt; &#34;XTC/123&#34;)
167
- )
168
- end
169
-
170
- def test_action_prefix_alone
171
- assert_equal(
172
- - &#34;http://www.singlefile.com/library/books/XTC/123/&#34;,
173
- @library_url.rewrite(:action_prefix =&gt; &#34;XTC/123&#34;)
174
- )
175
- end
176
-
177
- def test_action_with_suffix
178
- assert_equal(
179
- - &#34;http://www.singlefile.com/library/books/show/XTC/123&#34;,
180
- @library_url.rewrite(:action =&gt; &#34;show&#34;, :action_prefix =&gt; &#34;&#34;, :action_suffix =&gt; &#34;XTC/123&#34;)
181
- )
182
- end
183
-
184
- def test_clean_controller
185
- - assert_equal &#34;http://www.singlefile.com/library/settings/&#34;, @library_url.rewrite(:controller =&gt; &#34;settings&#34;)
186
- end
187
-
188
- def test_clean_controller_prefix
189
- - assert_equal &#34;http://www.singlefile.com/shop/&#34;, @library_url.rewrite(:controller_prefix =&gt; &#34;shop&#34;)
190
- end
191
-
192
- def test_clean_controller_with_module
193
- - assert_equal &#34;http://www.singlefile.com/shop/purchases/&#34;, @library_url.rewrite(:module =&gt; &#34;shop&#34;, :controller =&gt; &#34;purchases&#34;)
194
- end
195
-
196
- def test_getting_out_of_a_module
197
- - assert_equal &#34;http://www.singlefile.com/purchases/&#34;, @library_url_using_module.rewrite(:module =&gt; false, :controller =&gt; &#34;purchases&#34;)
198
- end
199
-
200
- def test_controller_and_action
201
- - assert_equal &#34;http://www.singlefile.com/library/settings/show&#34;, @library_url.rewrite(:controller =&gt; &#34;settings&#34;, :action =&gt; &#34;show&#34;)
202
- end
203
-
204
- def test_controller_and_action_and_anchor
205
- assert_equal(
206
- - &#34;http://www.singlefile.com/library/settings/show#5&#34;,
207
- @library_url.rewrite(:controller =&gt; &#34;settings&#34;, :action =&gt; &#34;show&#34;, :anchor =&gt; &#34;5&#34;)
208
- )
209
- end
210
-
211
- def test_controller_and_action_and_empty_overwrite_params_and_anchor
212
- assert_equal(
213
- - &#34;http://www.singlefile.com/library/settings/show?code=0743536703&amp;type=ISBN#5&#34;,
214
- @library_url.rewrite(:controller =&gt; &#34;settings&#34;, :action =&gt; &#34;show&#34;, :overwrite_params =&gt; {}, :anchor =&gt; &#34;5&#34;)
215
- )
216
- end
217
-
218
- def test_controller_and_action_and_overwrite_params_and_anchor
219
- assert_equal(
220
- - &#34;http://www.singlefile.com/library/settings/show?code=0000001&amp;type=ISBN#5&#34;,
221
- @library_url.rewrite(:controller =&gt; &#34;settings&#34;, :action =&gt; &#34;show&#34;, :overwrite_params =&gt; {&#34;code&#34;=&gt;&#34;0000001&#34;}, :anchor =&gt; &#34;5&#34;)
222
- )
223
- end
224
-
225
- def test_controller_and_action_and_overwrite_params_with_nil_value_and_anchor
226
- assert_equal(
227
- - &#34;http://www.singlefile.com/library/settings/show?type=ISBN#5&#34;,
228
- @library_url.rewrite(:controller =&gt; &#34;settings&#34;, :action =&gt; &#34;show&#34;, :overwrite_params =&gt; {&#34;code&#34; =&gt; nil}, :anchor =&gt; &#34;5&#34;)
229
- )
230
- end
231
-
232
- def test_controller_and_action_params_and_overwrite_params_and_anchor
233
- assert_equal(
234
- - &#34;http://www.singlefile.com/library/settings/show?code=0000001&amp;version=5.0#5&#34;,
235
- @library_url.rewrite(:controller =&gt; &#34;settings&#34;, :action =&gt; &#34;show&#34;, :params=&gt;{&#34;version&#34; =&gt; &#34;5.0&#34;}, :overwrite_params =&gt; {&#34;code&#34;=&gt;&#34;0000001&#34;}, :anchor =&gt; &#34;5&#34;)
236
- )
237
- end
238
-
239
- def test_controller_and_action_and_params_anchor
240
- assert_equal(
241
- - &#34;http://www.singlefile.com/library/settings/show?update=1#5&#34;,
242
- @library_url.rewrite(:controller =&gt; &#34;settings&#34;, :action =&gt; &#34;show&#34;, :params =&gt; { &#34;update&#34; =&gt; &#34;1&#34;}, :anchor =&gt; &#34;5&#34;)
243
- )
244
- end
245
-
246
- def test_controller_and_index_action
247
- - assert_equal &#34;http://www.singlefile.com/library/settings/&#34;, @library_url.rewrite(:controller =&gt; &#34;settings&#34;, :action =&gt; &#34;index&#34;)
248
- end
249
-
250
- def test_same_controller_and_action_names
251
- - assert_equal &#34;http://www.singlefile.com/login/logout&#34;, @clean_url_with_same_action_and_controller_name.rewrite(:action =&gt; &#34;logout&#34;)
252
- end
253
-
254
- def xtest_same_module_and_controller_and_action_names
255
- - assert_equal &#34;http://www.singlefile.com/login/login/logout&#34;, @clean_url_with_same_action_and_controller_and_module_name.rewrite(:action =&gt; &#34;logout&#34;)
256
- end
257
-
258
- def test_controller_and_action_with_same_name_as_controller
259
- @clean_urls.each do |url|
260
- - assert_equal &#34;http://www.singlefile.com/anything/identity&#34;, url.rewrite(:controller =&gt; &#34;anything&#34;, :action =&gt; &#34;identity&#34;)
261
- end
262
- end
263
-
264
- def test_controller_and_index_action_without_controller_prefix
265
- assert_equal(
266
- - &#34;http://www.singlefile.com/settings/&#34;,
267
- @library_url.rewrite(:controller =&gt; &#34;settings&#34;, :action =&gt; &#34;index&#34;, :controller_prefix =&gt; &#34;&#34;)
268
- )
269
- end
270
-
271
- def test_controller_and_index_action_with_controller_prefix
272
- assert_equal(
273
- - &#34;http://www.singlefile.com/fantastic/settings/show&#34;,
274
- @library_url.rewrite(:controller =&gt; &#34;settings&#34;, :action =&gt; &#34;show&#34;, :controller_prefix =&gt; &#34;fantastic&#34;)
275
- )
276
- end
277
-
278
- def test_path_parameters
279
- - assert_equal &#34;http://www.singlefile.com/library/books/EXBC/0743536703/show&#34;, @library_url.rewrite(:path_params =&gt; {&#34;type&#34; =&gt; &#34;EXBC&#34;})
280
- end
281
-
282
- def test_parameters
283
- assert_equal(
284
- - &#34;http://www.singlefile.com/library/books/ISBN/0743536703/show?delete=1&amp;name=David&#34;,
285
- @library_url.rewrite(:params =&gt; {&#34;delete&#34; =&gt; &#34;1&#34;, &#34;name&#34; =&gt; &#34;David&#34;})
286
- )
287
- end
288
- --- 106,246 ----
289
- end
290
-
291
- def test_action_from_index
292
- + assert_equal &#34;http://www.example.com/library/books/ISBN/0743536703/edit&#34;, @library_url_on_index.rewrite(:action =&gt; &#34;edit&#34;)
293
- end
294
-
295
- def test_action_from_index_on_clean
296
- @clean_urls.each do |url|
297
- + assert_equal &#34;http://www.example.com/identity/edit&#34;, url.rewrite(:action =&gt; &#34;edit&#34;)
298
- end
299
- end
300
-
301
- def test_action_without_prefix
302
- + assert_equal &#34;http://www.example.com/library/books/&#34;, @library_url.rewrite(:action =&gt; &#34;index&#34;, :action_prefix =&gt; &#34;&#34;)
303
- end
304
-
305
- def test_action_with_prefix
306
- assert_equal(
307
- + &#34;http://www.example.com/library/books/XTC/123/show&#34;,
308
- @library_url.rewrite(:action =&gt; &#34;show&#34;, :action_prefix =&gt; &#34;XTC/123&#34;)
309
- )
310
- end
311
-
312
- def test_action_prefix_alone
313
- assert_equal(
314
- + &#34;http://www.example.com/library/books/XTC/123/&#34;,
315
- @library_url.rewrite(:action_prefix =&gt; &#34;XTC/123&#34;)
316
- )
317
- end
318
-
319
- def test_action_with_suffix
320
- assert_equal(
321
- + &#34;http://www.example.com/library/books/show/XTC/123&#34;,
322
- @library_url.rewrite(:action =&gt; &#34;show&#34;, :action_prefix =&gt; &#34;&#34;, :action_suffix =&gt; &#34;XTC/123&#34;)
323
- )
324
- end
325
-
326
- def test_clean_controller
327
- + assert_equal &#34;http://www.example.com/library/settings/&#34;, @library_url.rewrite(:controller =&gt; &#34;settings&#34;)
328
- end
329
-
330
- def test_clean_controller_prefix
331
- + assert_equal &#34;http://www.example.com/shop/&#34;, @library_url.rewrite(:controller_prefix =&gt; &#34;shop&#34;)
332
- end
333
-
334
- def test_clean_controller_with_module
335
- + assert_equal &#34;http://www.example.com/shop/purchases/&#34;, @library_url.rewrite(:module =&gt; &#34;shop&#34;, :controller =&gt; &#34;purchases&#34;)
336
- end
337
-
338
- def test_getting_out_of_a_module
339
- + assert_equal &#34;http://www.example.com/purchases/&#34;, @library_url_using_module.rewrite(:module =&gt; false, :controller =&gt; &#34;purchases&#34;)
340
- end
341
-
342
- def test_controller_and_action
343
- + assert_equal &#34;http://www.example.com/library/settings/show&#34;, @library_url.rewrite(:controller =&gt; &#34;settings&#34;, :action =&gt; &#34;show&#34;)
344
- end
345
-
346
- def test_controller_and_action_and_anchor
347
- assert_equal(
348
- + &#34;http://www.example.com/library/settings/show#5&#34;,
349
- @library_url.rewrite(:controller =&gt; &#34;settings&#34;, :action =&gt; &#34;show&#34;, :anchor =&gt; &#34;5&#34;)
350
- )
351
- end
352
-
353
- def test_controller_and_action_and_empty_overwrite_params_and_anchor
354
- assert_equal(
355
- + &#34;http://www.example.com/library/settings/show?code=0743536703&amp;type=ISBN#5&#34;,
356
- @library_url.rewrite(:controller =&gt; &#34;settings&#34;, :action =&gt; &#34;show&#34;, :overwrite_params =&gt; {}, :anchor =&gt; &#34;5&#34;)
357
- )
358
- end
359
-
360
- def test_controller_and_action_and_overwrite_params_and_anchor
361
- assert_equal(
362
- + &#34;http://www.example.com/library/settings/show?code=0000001&amp;type=ISBN#5&#34;,
363
- @library_url.rewrite(:controller =&gt; &#34;settings&#34;, :action =&gt; &#34;show&#34;, :overwrite_params =&gt; {&#34;code&#34;=&gt;&#34;0000001&#34;}, :anchor =&gt; &#34;5&#34;)
364
- )
365
- end
366
-
367
- def test_controller_and_action_and_overwrite_params_with_nil_value_and_anchor
368
- assert_equal(
369
- + &#34;http://www.example.com/library/settings/show?type=ISBN#5&#34;,
370
- @library_url.rewrite(:controller =&gt; &#34;settings&#34;, :action =&gt; &#34;show&#34;, :overwrite_params =&gt; {&#34;code&#34; =&gt; nil}, :anchor =&gt; &#34;5&#34;)
371
- )
372
- end
373
-
374
- def test_controller_and_action_params_and_overwrite_params_and_anchor
375
- assert_equal(
376
- + &#34;http://www.example.com/library/settings/show?code=0000001&amp;version=5.0#5&#34;,
377
- @library_url.rewrite(:controller =&gt; &#34;settings&#34;, :action =&gt; &#34;show&#34;, :params=&gt;{&#34;version&#34; =&gt; &#34;5.0&#34;}, :overwrite_params =&gt; {&#34;code&#34;=&gt;&#34;0000001&#34;}, :anchor =&gt; &#34;5&#34;)
378
- )
379
- end
380
-
381
- def test_controller_and_action_and_params_anchor
382
- assert_equal(
383
- + &#34;http://www.example.com/library/settings/show?update=1#5&#34;,
384
- @library_url.rewrite(:controller =&gt; &#34;settings&#34;, :action =&gt; &#34;show&#34;, :params =&gt; { &#34;update&#34; =&gt; &#34;1&#34;}, :anchor =&gt; &#34;5&#34;)
385
- )
386
- end
387
-
388
- def test_controller_and_index_action
389
- + assert_equal &#34;http://www.example.com/library/settings/&#34;, @library_url.rewrite(:controller =&gt; &#34;settings&#34;, :action =&gt; &#34;index&#34;)
390
- end
391
-
392
- def test_same_controller_and_action_names
393
- + assert_equal &#34;http://www.example.com/login/logout&#34;, @clean_url_with_same_action_and_controller_name.rewrite(:action =&gt; &#34;logout&#34;)
394
- end
395
-
396
- def xtest_same_module_and_controller_and_action_names
397
- + assert_equal &#34;http://www.example.com/login/login/logout&#34;, @clean_url_with_same_action_and_controller_and_module_name.rewrite(:action =&gt; &#34;logout&#34;)
398
- end
399
-
400
- def test_controller_and_action_with_same_name_as_controller
401
- @clean_urls.each do |url|
402
- + assert_equal &#34;http://www.example.com/anything/identity&#34;, url.rewrite(:controller =&gt; &#34;anything&#34;, :action =&gt; &#34;identity&#34;)
403
- end
404
- end
405
-
406
- def test_controller_and_index_action_without_controller_prefix
407
- assert_equal(
408
- + &#34;http://www.example.com/settings/&#34;,
409
- @library_url.rewrite(:controller =&gt; &#34;settings&#34;, :action =&gt; &#34;index&#34;, :controller_prefix =&gt; &#34;&#34;)
410
- )
411
- end
412
-
413
- def test_controller_and_index_action_with_controller_prefix
414
- assert_equal(
415
- + &#34;http://www.example.com/fantastic/settings/show&#34;,
416
- @library_url.rewrite(:controller =&gt; &#34;settings&#34;, :action =&gt; &#34;show&#34;, :controller_prefix =&gt; &#34;fantastic&#34;)
417
- )
418
- end
419
-
420
- def test_path_parameters
421
- + assert_equal &#34;http://www.example.com/library/books/EXBC/0743536703/show&#34;, @library_url.rewrite(:path_params =&gt; {&#34;type&#34; =&gt; &#34;EXBC&#34;})
422
- end
423
-
424
- def test_parameters
425
- assert_equal(
426
- + &#34;http://www.example.com/library/books/ISBN/0743536703/show?delete=1&amp;name=David&#34;,
427
- @library_url.rewrite(:params =&gt; {&#34;delete&#34; =&gt; &#34;1&#34;, &#34;name&#34; =&gt; &#34;David&#34;})
428
- )
429
- end
430
- ***************
431
- *** 248,254 ****
432
- def test_parameters_with_id
433
- @clean_urls.each do |url|
434
- assert_equal(
435
- - &#34;http://www.singlefile.com/identity/show?name=David&amp;id=5&#34;,
436
- url.rewrite(
437
- :action =&gt; &#34;show&#34;,
438
- :params =&gt; { &#34;id&#34; =&gt; &#34;5&#34;, &#34;name&#34; =&gt; &#34;David&#34; }
439
- --- 248,254 ----
440
- def test_parameters_with_id
441
- @clean_urls.each do |url|
442
- assert_equal(
443
- + &#34;http://www.example.com/identity/show?name=David&amp;id=5&#34;,
444
- url.rewrite(
445
- :action =&gt; &#34;show&#34;,
446
- :params =&gt; { &#34;id&#34; =&gt; &#34;5&#34;, &#34;name&#34; =&gt; &#34;David&#34; }
447
- ***************
448
- *** 260,266 ****
449
- def test_parameters_with_array
450
- @clean_urls.each do |url|
451
- assert_equal(
452
- - &#34;http://www.singlefile.com/identity/show?id[]=3&amp;id[]=5&amp;id[]=10&#34;,
453
- url.rewrite(
454
- :action =&gt; &#34;show&#34;,
455
- :params =&gt; { 'id' =&gt; [ 3, 5, 10 ] } )
456
- --- 260,266 ----
457
- def test_parameters_with_array
458
- @clean_urls.each do |url|
459
- assert_equal(
460
- + &#34;http://www.example.com/identity/show?id[]=3&amp;id[]=5&amp;id[]=10&#34;,
461
- url.rewrite(
462
- :action =&gt; &#34;show&#34;,
463
- :params =&gt; { 'id' =&gt; [ 3, 5, 10 ] } )
464
- ***************
465
- *** 270,276 ****
466
-
467
- def test_action_with_id
468
- assert_equal(
469
- - &#34;http://www.singlefile.com/identity/show/7&#34;,
470
- @clean_url_with_id.rewrite(
471
- :action =&gt; &#34;show&#34;,
472
- :id =&gt; 7
473
- --- 270,276 ----
474
-
475
- def test_action_with_id
476
- assert_equal(
477
- + &#34;http://www.example.com/identity/show/7&#34;,
478
- @clean_url_with_id.rewrite(
479
- :action =&gt; &#34;show&#34;,
480
- :id =&gt; 7
481
- ***************
482
- *** 278,284 ****
483
- )
484
- @clean_urls.each do |url|
485
- assert_equal(
486
- - &#34;http://www.singlefile.com/identity/index/7&#34;,
487
- url.rewrite(:id =&gt; 7)
488
- )
489
- end
490
- --- 278,284 ----
491
- )
492
- @clean_urls.each do |url|
493
- assert_equal(
494
- + &#34;http://www.example.com/identity/index/7&#34;,
495
- url.rewrite(:id =&gt; 7)
496
- )
497
- end
498
- ***************
499
- *** 286,292 ****
500
-
501
- def test_parameters_with_id_and_away
502
- assert_equal(
503
- - &#34;http://www.singlefile.com/identity/show/25?name=David&#34;,
504
- @clean_url_with_id.rewrite(
505
- :path_params =&gt; { &#34;id&#34; =&gt; &#34;25&#34; },
506
- :params =&gt; { &#34;name&#34; =&gt; &#34;David&#34; }
507
- --- 286,292 ----
508
-
509
- def test_parameters_with_id_and_away
510
- assert_equal(
511
- + &#34;http://www.example.com/identity/show/25?name=David&#34;,
512
- @clean_url_with_id.rewrite(
513
- :path_params =&gt; { &#34;id&#34; =&gt; &#34;25&#34; },
514
- :params =&gt; { &#34;name&#34; =&gt; &#34;David&#34; }
515
- ***************
516
- *** 297,303 ****
517
- def test_parameters_with_index_and_id
518
- @clean_urls.each do |url|
519
- assert_equal(
520
- - &#34;http://www.singlefile.com/identity/index/25?name=David&#34;,
521
- url.rewrite(
522
- :path_params =&gt; { &#34;id&#34; =&gt; &#34;25&#34; },
523
- :params =&gt; { &#34;name&#34; =&gt; &#34;David&#34; }
524
- --- 297,303 ----
525
- def test_parameters_with_index_and_id
526
- @clean_urls.each do |url|
527
- assert_equal(
528
- + &#34;http://www.example.com/identity/index/25?name=David&#34;,
529
- url.rewrite(
530
- :path_params =&gt; { &#34;id&#34; =&gt; &#34;25&#34; },
531
- :params =&gt; { &#34;name&#34; =&gt; &#34;David&#34; }
532
- ***************
533
- *** 308,314 ****
534
-
535
- def test_action_going_away_from_id
536
- assert_equal(
537
- - &#34;http://www.singlefile.com/identity/list&#34;,
538
- @clean_url_with_id.rewrite(
539
- :action =&gt; &#34;list&#34;
540
- )
541
- --- 308,314 ----
542
-
543
- def test_action_going_away_from_id
544
- assert_equal(
545
- + &#34;http://www.example.com/identity/list&#34;,
546
- @clean_url_with_id.rewrite(
547
- :action =&gt; &#34;list&#34;
548
- )
549
- ***************
550
- *** 317,323 ****
551
-
552
- def test_parameters_with_direct_id_and_away
553
- assert_equal(
554
- - &#34;http://www.singlefile.com/identity/show/25?name=David&#34;,
555
- @clean_url_with_id.rewrite(
556
- :id =&gt; &#34;25&#34;,
557
- :params =&gt; { &#34;name&#34; =&gt; &#34;David&#34; }
558
- --- 317,323 ----
559
-
560
- def test_parameters_with_direct_id_and_away
561
- assert_equal(
562
- + &#34;http://www.example.com/identity/show/25?name=David&#34;,
563
- @clean_url_with_id.rewrite(
564
- :id =&gt; &#34;25&#34;,
565
- :params =&gt; { &#34;name&#34; =&gt; &#34;David&#34; }
566
- ***************
567
- *** 327,333 ****
568
-
569
- def test_parameters_with_direct_id_and_away
570
- assert_equal(
571
- - &#34;http://www.singlefile.com/store/open/25?name=David&#34;,
572
- @clean_url_with_id.rewrite(
573
- :controller =&gt; &#34;store&#34;,
574
- :action =&gt; &#34;open&#34;,
575
- --- 327,333 ----
576
-
577
- def test_parameters_with_direct_id_and_away
578
- assert_equal(
579
- + &#34;http://www.example.com/store/open/25?name=David&#34;,
580
- @clean_url_with_id.rewrite(
581
- :controller =&gt; &#34;store&#34;,
582
- :action =&gt; &#34;open&#34;,
583
- ***************
584
- *** 341,347 ****
585
- @clean_urls.each do |url|
586
- %w(show index).each do |action|
587
- assert_equal(
588
- - &#34;http://www.singlefile.com/identity/#{action}/25?name=David&#34;,
589
- url.rewrite(
590
- :action =&gt; action,
591
- :path_params =&gt; { &#34;id&#34; =&gt; &#34;25&#34; },
592
- --- 341,347 ----
593
- @clean_urls.each do |url|
594
- %w(show index).each do |action|
595
- assert_equal(
596
- + &#34;http://www.example.com/identity/#{action}/25?name=David&#34;,
597
- url.rewrite(
598
- :action =&gt; action,
599
- :path_params =&gt; { &#34;id&#34; =&gt; &#34;25&#34; },
600
- ***************
601
- *** 354,360 ****
602
-
603
- def test_parameters_from_id
604
- assert_equal(
605
- - &#34;http://www.singlefile.com/identity/&#34;,
606
- @clean_url_with_id.rewrite(
607
- :action =&gt; &#34;index&#34;
608
- )
609
- --- 354,360 ----
610
-
611
- def test_parameters_from_id
612
- assert_equal(
613
- + &#34;http://www.example.com/identity/&#34;,
614
- @clean_url_with_id.rewrite(
615
- :action =&gt; &#34;index&#34;
616
- )
617
- ***************
618
- *** 363,369 ****
619
-
620
- def test_id_as_char_and_part_of_controller
621
- assert_equal(
622
- - &#34;http://www.singlefile.com/teachers/skill/5&#34;,
623
- @clean_url_with_id_as_char.rewrite(
624
- :action =&gt; &#34;skill&#34;,
625
- :id =&gt; 5
626
- --- 363,369 ----
627
-
628
- def test_id_as_char_and_part_of_controller
629
- assert_equal(
630
- + &#34;http://www.example.com/teachers/skill/5&#34;,
631
- @clean_url_with_id_as_char.rewrite(
632
- :action =&gt; &#34;skill&#34;,
633
- :id =&gt; 5
634
- ***************
635
- *** 374,380 ****
636
- def test_from_clean_to_library
637
- @clean_urls.each do |url|
638
- assert_equal(
639
- - &#34;http://www.singlefile.com/library/books/ISBN/0743536703/show?delete=1&amp;name=David&#34;,
640
- url.rewrite(
641
- :controller_prefix =&gt; &#34;library&#34;,
642
- :controller =&gt; &#34;books&#34;,
643
- --- 374,380 ----
644
- def test_from_clean_to_library
645
- @clean_urls.each do |url|
646
- assert_equal(
647
- + &#34;http://www.example.com/library/books/ISBN/0743536703/show?delete=1&amp;name=David&#34;,
648
- url.rewrite(
649
- :controller_prefix =&gt; &#34;library&#34;,
650
- :controller =&gt; &#34;books&#34;,
651
- ***************
652
- *** 388,394 ****
653
-
654
- def test_from_library_to_clean
655
- assert_equal(
656
- - &#34;http://www.singlefile.com/identity/&#34;,
657
- @library_url.rewrite(
658
- :controller =&gt; &#34;identity&#34;, :controller_prefix =&gt; &#34;&#34;
659
- )
660
- --- 388,394 ----
661
-
662
- def test_from_library_to_clean
663
- assert_equal(
664
- + &#34;http://www.example.com/identity/&#34;,
665
- @library_url.rewrite(
666
- :controller =&gt; &#34;identity&#34;, :controller_prefix =&gt; &#34;&#34;
667
- )
668
- ***************
669
- *** 398,411 ****
670
- def test_from_another_port
671
- @library_url = ActionController::UrlRewriter.old_new(MockRequest.new(
672
- &#34;http://&#34;,
673
- - &#34;www.singlefile.com&#34;,
674
- 8080,
675
- &#34;/library/books/ISBN/0743536703/show&#34;,
676
- { &#34;type&#34; =&gt; &#34;ISBN&#34;, &#34;code&#34; =&gt; &#34;0743536703&#34; }
677
- ), &#34;books&#34;, &#34;show&#34;)
678
-
679
- assert_equal(
680
- - &#34;http://www.singlefile.com:8080/identity/&#34;,
681
- @library_url.rewrite(
682
- :controller =&gt; &#34;identity&#34;, :controller_prefix =&gt; &#34;&#34;
683
- )
684
- --- 398,411 ----
685
- def test_from_another_port
686
- @library_url = ActionController::UrlRewriter.old_new(MockRequest.new(
687
- &#34;http://&#34;,
688
- + &#34;www.example.com&#34;,
689
- 8080,
690
- &#34;/library/books/ISBN/0743536703/show&#34;,
691
- { &#34;type&#34; =&gt; &#34;ISBN&#34;, &#34;code&#34; =&gt; &#34;0743536703&#34; }
692
- ), &#34;books&#34;, &#34;show&#34;)
693
-
694
- assert_equal(
695
- + &#34;http://www.example.com:8080/identity/&#34;,
696
- @library_url.rewrite(
697
- :controller =&gt; &#34;identity&#34;, :controller_prefix =&gt; &#34;&#34;
698
- )
699
- ***************
700
- *** 465,487 ****
701
- end
702
-
703
- def test_clean_application_prefix
704
- - assert_equal &#34;http://www.singlefile.com/namespace/library/books/ISBN/0743536703/show&#34;,
705
- @library_url.rewrite(:application_prefix =&gt; &#34;/namespace&#34;)
706
- end
707
-
708
- def test_clean_application_prefix_with_controller_prefix
709
- - assert_equal &#34;http://www.singlefile.com/namespace/shop/&#34;,
710
- @library_url.rewrite(:application_prefix =&gt; &#34;/namespace&#34;,
711
- :controller_prefix =&gt; &#34;shop&#34; )
712
- end
713
-
714
- def test_blank_application_prefix
715
- - assert_equal &#34;http://www.singlefile.com/library/books/ISBN/0743536703/show&#34;,
716
- @library_url.rewrite(:application_prefix =&gt; &#34;&#34;)
717
- end
718
-
719
- def test_nil_application_prefix
720
- - assert_equal &#34;http://www.singlefile.com/library/books/ISBN/0743536703/show&#34;,
721
- @library_url.rewrite(:application_prefix =&gt; nil)
722
- end
723
- end
724
- --- 465,487 ----
725
- end
726
-
727
- def test_clean_application_prefix
728
- + assert_equal &#34;http://www.example.com/namespace/library/books/ISBN/0743536703/show&#34;,
729
- @library_url.rewrite(:application_prefix =&gt; &#34;/namespace&#34;)
730
- end
731
-
732
- def test_clean_application_prefix_with_controller_prefix
733
- + assert_equal &#34;http://www.example.com/namespace/shop/&#34;,
734
- @library_url.rewrite(:application_prefix =&gt; &#34;/namespace&#34;,
735
- :controller_prefix =&gt; &#34;shop&#34; )
736
- end
737
-
738
- def test_blank_application_prefix
739
- + assert_equal &#34;http://www.example.com/library/books/ISBN/0743536703/show&#34;,
740
- @library_url.rewrite(:application_prefix =&gt; &#34;&#34;)
741
- end
742
-
743
- def test_nil_application_prefix
744
- + assert_equal &#34;http://www.example.com/library/books/ISBN/0743536703/show&#34;,
745
- @library_url.rewrite(:application_prefix =&gt; nil)
746
- end
747
- end