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