rewritten 0.15.2 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +12 -0
- data/.rubocop_todo.yml +116 -0
- data/Gemfile +1 -1
- data/HISTORY.rdoc +4 -0
- data/Rakefile +1 -5
- data/bin/rewritten-dump.rb +11 -14
- data/bin/rewritten-import.rb +9 -12
- data/bin/rewritten-web.rb +7 -9
- data/config.ru +0 -1
- data/lib/rack/canonical.rb +6 -14
- data/lib/rack/dummy.rb +7 -14
- data/lib/rack/html.rb +4 -13
- data/lib/rack/record.rb +3 -9
- data/lib/rack/subdomain.rb +5 -13
- data/lib/rack/url.rb +19 -24
- data/lib/rewritten.rb +45 -69
- data/lib/rewritten/config.ru +0 -1
- data/lib/rewritten/document.rb +6 -7
- data/lib/rewritten/helpers.rb +0 -1
- data/lib/rewritten/rails/url_helpers.rb +0 -3
- data/lib/rewritten/server.rb +58 -73
- data/lib/rewritten/server/test_helper.rb +2 -2
- data/lib/rewritten/version.rb +1 -2
- data/rewritten.gemspec +19 -22
- data/test/rack/rewritten_canonical_test.rb +23 -31
- data/test/rack/rewritten_html_test.rb +16 -21
- data/test/rack/rewritten_url_test.rb +77 -95
- data/test/rewritten/document_test.rb +28 -28
- data/test/rewritten_test.rb +25 -36
- data/test/test_helper.rb +2 -4
- metadata +4 -2
@@ -1,16 +1,14 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
describe Rack::Rewritten::Url do
|
4
|
-
|
5
|
-
before {
|
4
|
+
before do
|
6
5
|
Rewritten.add_translation '/foo/bar', '/products/1'
|
7
6
|
Rewritten.add_translation '/foo/baz', '/products/1'
|
8
7
|
Rewritten.add_translation '/foo/with/params', '/products/2?w=1'
|
9
|
-
|
10
|
-
|
11
|
-
describe "substition behavior" do
|
8
|
+
end
|
12
9
|
|
13
|
-
|
10
|
+
describe 'substition behavior' do
|
11
|
+
before do
|
14
12
|
@html_body = <<-HTML
|
15
13
|
<html>
|
16
14
|
<body>
|
@@ -25,25 +23,22 @@ describe Rack::Rewritten::Url do
|
|
25
23
|
</html>
|
26
24
|
HTML
|
27
25
|
|
28
|
-
@rack = Rack::Rewritten::Html.new(
|
29
|
-
|
26
|
+
@rack = Rack::Rewritten::Html.new(->(_env) { [200, {}, [@html_body]] })
|
27
|
+
end
|
30
28
|
|
31
|
-
it
|
32
|
-
|
33
|
-
html = body.join(
|
29
|
+
it 'must ignore everything' do
|
30
|
+
_res, _env, body = @rack.call({})
|
31
|
+
html = body.join('')
|
34
32
|
html.must_equal @html_body
|
35
33
|
end
|
36
34
|
|
37
|
-
it
|
38
|
-
Rewritten.add_translation('/bar', '/foo')
|
39
|
-
|
40
|
-
html = body.join(
|
41
|
-
assert ! (html =~ (/foo\??["']/)
|
42
|
-
assert html.include?
|
43
|
-
assert html.include?(
|
35
|
+
it 'must replace links with translations' do
|
36
|
+
Rewritten.add_translation('/bar', '/foo')
|
37
|
+
_res, _env, body = @rack.call({})
|
38
|
+
html = body.join('')
|
39
|
+
assert ! (html =~ (/foo\??["']/)), "didn't replace all /foo links"
|
40
|
+
assert html.include? '/bar'
|
41
|
+
assert html.include?('/foolmenot'), 'must not mess with similar links'
|
44
42
|
end
|
45
|
-
|
46
43
|
end
|
47
|
-
|
48
44
|
end
|
49
|
-
|
@@ -1,88 +1,84 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
describe Rack::Rewritten::Url do
|
4
|
-
|
5
|
-
|
6
|
-
{'HTTP_HOST' => 'www.example.org',
|
4
|
+
def call_args(overrides = {})
|
5
|
+
{ 'HTTP_HOST' => 'www.example.org',
|
7
6
|
'REQUEST_URI' => '/foo/with/params',
|
8
|
-
'SCRIPT_INFO'=> '',
|
7
|
+
'SCRIPT_INFO' => '',
|
9
8
|
'PATH_INFO' => '/foo/with/params',
|
10
9
|
'QUERY_STRING' => '',
|
11
10
|
'SERVER_PORT' => 80,
|
12
11
|
'rack.input' => '',
|
13
|
-
'rack.url_scheme' => 'http'}.merge(overrides)
|
12
|
+
'rack.url_scheme' => 'http' }.merge(overrides)
|
14
13
|
end
|
15
14
|
|
16
|
-
def request_url(url, params={})
|
17
|
-
call_args.merge({'REQUEST_URI' => url, 'PATH_INFO' => url}.merge(params)
|
15
|
+
def request_url(url, params = {})
|
16
|
+
call_args.merge({ 'REQUEST_URI' => url, 'PATH_INFO' => url }.merge(params))
|
18
17
|
end
|
19
18
|
|
20
|
-
before
|
19
|
+
before do
|
21
20
|
Rewritten.add_translation '/foo/bar', '/products/1'
|
22
21
|
Rewritten.add_translation '/foo/baz', '/products/1'
|
23
22
|
Rewritten.add_translation '/foo/with/params', '/products/2?w=1'
|
24
|
-
|
25
|
-
|
26
|
-
describe "redirection behavior" do
|
23
|
+
Rewritten.add_translation '/foo/with/params?w=1', '/embed/2'
|
24
|
+
end
|
27
25
|
|
28
|
-
|
26
|
+
describe 'redirection behavior' do
|
27
|
+
before do
|
29
28
|
@app = MiniTest::Mock.new
|
30
29
|
@rack = Rack::Rewritten::Url.new(@app)
|
31
30
|
|
32
31
|
Rewritten.add_translation '/foo/bar', '/products/1'
|
33
32
|
Rewritten.add_translation '/foo/baz', '/products/1'
|
34
33
|
Rewritten.add_translation '/foo/with/params', '/products/2?w=1'
|
35
|
-
|
34
|
+
end
|
36
35
|
|
37
|
-
it
|
38
|
-
@app.expect :call, [200, {'Content-Type' => 'text/plain'},[
|
36
|
+
it 'must not redirect if there are no entries' do
|
37
|
+
@app.expect :call, [200, { 'Content-Type' => 'text/plain' }, ['']], [Hash]
|
39
38
|
@rack.call(call_args)
|
40
39
|
@app.verify
|
41
40
|
end
|
42
41
|
|
43
|
-
it
|
42
|
+
it 'must 301 redirect from old translation to latest translation' do
|
44
43
|
ret = @rack.call request_url('/foo/bar')
|
45
44
|
@app.verify
|
46
45
|
ret[0].must_equal 301
|
47
|
-
ret[1]['Location'].must_equal
|
46
|
+
ret[1]['Location'].must_equal 'http://www.example.org/foo/baz'
|
48
47
|
end
|
49
48
|
|
50
|
-
it
|
49
|
+
it 'must keep the query parameters in the 301 redirect' do
|
51
50
|
ret = @rack.call request_url('/foo/bar', 'QUERY_STRING' => 'w=1')
|
52
51
|
@app.verify
|
53
52
|
ret[0].must_equal 301
|
54
|
-
ret[1]['Location'].must_equal
|
53
|
+
ret[1]['Location'].must_equal 'http://www.example.org/foo/baz?w=1'
|
55
54
|
end
|
56
55
|
|
57
|
-
it
|
58
|
-
@app.expect :call, [200, {'Content-Type' => 'text/plain'},[
|
56
|
+
it 'must stay on latest translation' do
|
57
|
+
@app.expect :call, [200, { 'Content-Type' => 'text/plain' }, ['']], [Hash]
|
59
58
|
ret = @rack.call request_url('/foo/baz')
|
60
59
|
@app.verify
|
61
60
|
ret[0].must_equal 200
|
62
61
|
end
|
63
62
|
|
64
63
|
describe 'external redirection' do
|
65
|
-
|
66
|
-
before {
|
64
|
+
before do
|
67
65
|
@app = MiniTest::Mock.new
|
68
66
|
@rack = Rack::Rewritten::Url.new(@app) do |config|
|
69
67
|
config.base_url = 'http://www.example.org'
|
70
68
|
end
|
71
69
|
|
72
70
|
Rewritten.add_translation '/external/target', 'http://www.external.com'
|
73
|
-
|
71
|
+
end
|
74
72
|
|
75
|
-
it
|
73
|
+
it 'must redirect to external target' do
|
76
74
|
ret = @rack.call request_url('/external/target')
|
77
75
|
@app.verify
|
78
76
|
ret[0].must_equal 301
|
79
|
-
ret[1]['Location'].must_equal
|
77
|
+
ret[1]['Location'].must_equal 'http://www.external.com'
|
80
78
|
end
|
81
|
-
|
82
79
|
end
|
83
80
|
|
84
|
-
describe
|
85
|
-
|
81
|
+
describe 'partial translation' do
|
86
82
|
before do
|
87
83
|
@request_str = '/foo/baz/with_tail'
|
88
84
|
@env = request_url(@request_str)
|
@@ -93,73 +89,68 @@ describe Rack::Rewritten::Url do
|
|
93
89
|
Rewritten.translate_partial = false
|
94
90
|
end
|
95
91
|
|
96
|
-
after{ Rewritten.translate_partial = false }
|
92
|
+
after { Rewritten.translate_partial = false }
|
97
93
|
|
98
|
-
it
|
94
|
+
it 'must not translate partials by default' do
|
99
95
|
Rewritten.translate_partial = false
|
100
|
-
@app.expect :call, [200, {'Content-Type' => 'text/plain'},[
|
101
|
-
|
96
|
+
@app.expect :call, [200, { 'Content-Type' => 'text/plain' }, ['']], [Hash]
|
97
|
+
@rack.call @env
|
102
98
|
@app.verify
|
103
99
|
@env['PATH_INFO'].must_equal @request_str
|
104
100
|
end
|
105
101
|
|
106
|
-
it
|
102
|
+
it 'must translate partials if enabled' do
|
107
103
|
Rewritten.translate_partial = true
|
108
|
-
@app.expect :call, [200, {'Content-Type' => 'text/html'},[]], [Hash]
|
109
|
-
|
104
|
+
@app.expect :call, [200, { 'Content-Type' => 'text/html' }, []], [Hash]
|
105
|
+
@rack.call @env
|
110
106
|
@app.verify
|
111
107
|
@env['PATH_INFO'].must_equal '/products/1/with_tail'
|
112
108
|
end
|
113
109
|
|
114
|
-
it
|
115
|
-
|
116
|
-
@app.expect :call, [200, {'Content-Type' => 'text/html'},[]], [Hash]
|
110
|
+
it 'must work on long, non-translated urls with partial translation enabled' do
|
111
|
+
@app.expect :call, [200, { 'Content-Type' => 'text/html' }, []], [Hash]
|
117
112
|
|
118
113
|
url = '/such/a/long/url/with/so/many/slashes/oh/my/god'
|
119
114
|
@env = request_url(url)
|
120
115
|
|
121
|
-
|
116
|
+
@rack.call @env
|
122
117
|
@app.verify
|
123
118
|
@env['PATH_INFO'].must_equal url
|
124
119
|
end
|
125
120
|
|
126
|
-
|
127
121
|
it "won't translate segments not by separated by slashes" do
|
128
|
-
@app.expect :call, [200, {'Content-Type' => 'text/plain'},[
|
129
|
-
|
122
|
+
@app.expect :call, [200, { 'Content-Type' => 'text/plain' }, ['']], [Hash]
|
123
|
+
@rack.call @env = request_url('/foo/bazzling')
|
130
124
|
@app.verify
|
131
125
|
@env['PATH_INFO'].must_equal '/foo/bazzling'
|
132
126
|
end
|
133
127
|
|
134
|
-
it
|
128
|
+
it 'must carry on trail when redirecting' do
|
135
129
|
ret = @rack.call request_url('/foo/bar/with_tail', 'QUERY_STRING' => 'w=1')
|
136
130
|
@app.verify
|
137
131
|
ret[0].must_equal 301
|
138
|
-
ret[1]['Location'].must_equal
|
132
|
+
ret[1]['Location'].must_equal 'http://www.example.org/foo/baz/with_tail?w=1'
|
139
133
|
end
|
140
134
|
end
|
141
135
|
|
142
|
-
describe
|
143
|
-
|
144
|
-
it "must 301 redirect paths with / in the end to their chomped version" do
|
136
|
+
describe '/ behavior' do
|
137
|
+
it 'must 301 redirect paths with / in the end to their chomped version' do
|
145
138
|
ret = @rack.call request_url('/foo/bar/')
|
146
139
|
@app.verify
|
147
140
|
ret[0].must_equal 301
|
148
|
-
ret[1]['Location'].must_equal
|
141
|
+
ret[1]['Location'].must_equal 'http://www.example.org/foo/baz'
|
149
142
|
end
|
150
|
-
|
151
143
|
end
|
152
144
|
|
153
|
-
describe
|
154
|
-
|
155
|
-
|
156
|
-
@app.expect :call, [200, {'Content-Type' => 'text/plain'},[""]], [Hash]
|
145
|
+
describe 'caps behavior' do
|
146
|
+
it 'must diferentiate caps' do
|
147
|
+
@app.expect :call, [200, { 'Content-Type' => 'text/plain' }, ['']], [Hash]
|
157
148
|
ret = @rack.call request_url('/Foo/Bar')
|
158
149
|
@app.verify
|
159
150
|
ret[0].must_equal 200
|
160
151
|
end
|
161
152
|
|
162
|
-
it
|
153
|
+
it 'must ignore caps if wished' do
|
163
154
|
@rack = Rack::Rewritten::Url.new(@app) do
|
164
155
|
self.downcase_before_lookup = true
|
165
156
|
end
|
@@ -168,22 +159,19 @@ describe Rack::Rewritten::Url do
|
|
168
159
|
|
169
160
|
@app.verify
|
170
161
|
ret[0].must_equal 301
|
171
|
-
ret[1]['Location'].must_equal
|
162
|
+
ret[1]['Location'].must_equal 'http://www.example.org/foo/baz'
|
172
163
|
end
|
173
|
-
|
174
164
|
end
|
175
165
|
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
it "must not redirect from resource url to nice url by default" do
|
180
|
-
@app.expect :call, [200, {'Content-Type' => 'text/plain'},[""]], [Hash]
|
166
|
+
describe 'enforce nice urls' do
|
167
|
+
it 'must not redirect from resource url to nice url by default' do
|
168
|
+
@app.expect :call, [200, { 'Content-Type' => 'text/plain' }, ['']], [Hash]
|
181
169
|
ret = @rack.call request_url('/products/1')
|
182
170
|
@app.verify
|
183
171
|
ret[0].must_equal 200
|
184
172
|
end
|
185
173
|
|
186
|
-
it
|
174
|
+
it 'must redirect from resource url to nice url if enabled' do
|
187
175
|
@rack = Rack::Rewritten::Url.new(@app) do
|
188
176
|
self.translate_backwards = true
|
189
177
|
end
|
@@ -191,78 +179,72 @@ describe Rack::Rewritten::Url do
|
|
191
179
|
ret = @rack.call request_url('/products/1')
|
192
180
|
@app.verify
|
193
181
|
ret[0].must_equal 301
|
194
|
-
ret[1]['Location'].must_equal
|
182
|
+
ret[1]['Location'].must_equal 'http://www.example.org/foo/baz'
|
195
183
|
end
|
196
|
-
|
197
184
|
end
|
198
185
|
|
199
|
-
describe
|
200
|
-
|
201
|
-
before {
|
186
|
+
describe 'flag behavior' do
|
187
|
+
before do
|
202
188
|
Rewritten.add_translation('/with/flags [L]', '/adwords/target')
|
203
189
|
Rewritten.add_translation('/with/flags2 [L]', '/adwords/target')
|
204
190
|
Rewritten.add_translation('/no/flags', '/adwords/target')
|
205
191
|
Rewritten.add_translation('/final/line', '/adwords/target')
|
206
|
-
|
192
|
+
end
|
207
193
|
|
208
|
-
it
|
209
|
-
@app.expect :call, [200, {'Content-Type' => 'text/plain'},[
|
210
|
-
@app.expect :call, [200, {'Content-Type' => 'text/plain'},[
|
194
|
+
it 'must stay on [L] flagged froms' do
|
195
|
+
@app.expect :call, [200, { 'Content-Type' => 'text/plain' }, ['']], [Hash]
|
196
|
+
@app.expect :call, [200, { 'Content-Type' => 'text/plain' }, ['']], [Hash]
|
211
197
|
|
212
|
-
ret = @rack.call(
|
198
|
+
ret = @rack.call(request_url('/with/flags'))
|
213
199
|
ret[0].must_equal 200
|
214
200
|
|
215
|
-
ret = @rack.call(
|
201
|
+
ret = @rack.call(request_url('/with/flags2'))
|
216
202
|
ret[0].must_equal 200
|
217
203
|
|
218
204
|
@app.verify
|
219
205
|
end
|
220
206
|
|
221
|
-
it
|
207
|
+
it 'must redirect for other entries' do
|
222
208
|
ret = @rack.call request_url('/no/flags')
|
223
209
|
@app.verify
|
224
210
|
ret[0].must_equal 301
|
225
|
-
ret[1]['Location'].must_equal
|
211
|
+
ret[1]['Location'].must_equal 'http://www.example.org/final/line'
|
226
212
|
end
|
227
|
-
|
228
213
|
end
|
229
|
-
|
230
214
|
end
|
231
215
|
|
232
|
-
|
233
|
-
|
234
|
-
describe "the env" do
|
235
|
-
|
236
|
-
before {
|
216
|
+
describe 'the env' do
|
217
|
+
before do
|
237
218
|
@initial_args = call_args.dup
|
238
|
-
@rack = Rack::Rewritten::Url.new(
|
239
|
-
|
219
|
+
@rack = Rack::Rewritten::Url.new(->(_env) { [200, {}, ['']] })
|
220
|
+
end
|
240
221
|
|
241
|
-
it
|
222
|
+
it 'must set PATH_INFO to /products/2' do
|
242
223
|
@rack.call(@initial_args)
|
243
|
-
@initial_args['PATH_INFO'].must_equal
|
224
|
+
@initial_args['PATH_INFO'].must_equal '/products/2'
|
244
225
|
end
|
245
226
|
|
246
|
-
it
|
227
|
+
it 'must set QUERY_STRING to w=1' do
|
247
228
|
@rack.call(@initial_args)
|
248
229
|
@initial_args['QUERY_STRING'].must_equal 'w=1'
|
249
230
|
end
|
250
231
|
|
251
|
-
it
|
232
|
+
it 'must merge QUERY parameters' do
|
252
233
|
@initial_args.merge!('QUERY_STRING' => 's=1')
|
253
234
|
@rack.call(@initial_args)
|
254
235
|
@initial_args['QUERY_STRING'].split('&').sort.must_equal ['s=1', 'w=1']
|
255
236
|
end
|
256
237
|
|
257
|
-
it
|
238
|
+
it 'must merge nested rails style QUERY parameters' do
|
258
239
|
@initial_args.merge!('QUERY_STRING' => 'x[id]=1')
|
259
240
|
@rack.call(@initial_args)
|
260
|
-
@initial_args['QUERY_STRING'].split('&').sort.map{|s| URI.unescape(s)}.must_equal ['w=1', 'x[id]=1']
|
241
|
+
@initial_args['QUERY_STRING'].split('&').sort.map { |s| URI.unescape(s) }.must_equal ['w=1', 'x[id]=1']
|
261
242
|
end
|
262
243
|
|
263
|
-
|
244
|
+
it 'must discriminate between explicit query string translations' do
|
245
|
+
@initial_args.merge!('QUERY_STRING' => 'w=1')
|
246
|
+
@rack.call(@initial_args)
|
247
|
+
@initial_args['PATH_INFO'].must_equal '/embed/2'
|
248
|
+
end
|
264
249
|
end
|
265
|
-
|
266
|
-
|
267
|
-
|
268
250
|
end
|
@@ -1,84 +1,84 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
describe Rewritten::Document do
|
4
|
-
|
5
4
|
before do
|
6
5
|
class Product
|
7
6
|
include Rewritten::Document
|
8
7
|
end
|
9
8
|
@instance = Product.new
|
10
|
-
def @instance.id
|
11
|
-
|
12
|
-
|
9
|
+
def @instance.id
|
10
|
+
123
|
11
|
+
end
|
12
|
+
def @instance.polymorphic_url(_object, _options = {})
|
13
|
+
"/products/#{id}"
|
14
|
+
end
|
15
|
+
def @instance.persisted?
|
16
|
+
true
|
17
|
+
end
|
13
18
|
end
|
14
19
|
|
15
20
|
it 'must add the rewritten methods to the class' do
|
16
21
|
@instance.respond_to?(:rewritten_url=).must_equal true
|
17
22
|
@instance.respond_to?(:rewritten_url).must_equal true
|
18
|
-
@instance.respond_to?(:
|
23
|
+
@instance.respond_to?(:rewritten_url?).must_equal true
|
19
24
|
end
|
20
25
|
|
21
26
|
it 'must return empty string when not persisted' do
|
27
|
+
def @instance.persisted?
|
28
|
+
false
|
29
|
+
end
|
22
30
|
|
23
|
-
|
24
|
-
|
25
|
-
@instance.rewritten_url.must_equal ""
|
31
|
+
@instance.rewritten_url.must_equal ''
|
26
32
|
end
|
27
33
|
|
28
34
|
describe 'add translation' do
|
29
|
-
|
30
35
|
describe 'url_for not overriden' do
|
31
36
|
it 'must return translation when persisted' do
|
32
|
-
Rewritten.add_translation('/foo/bar', '/products/123')
|
37
|
+
Rewritten.add_translation('/foo/bar', '/products/123')
|
33
38
|
@instance.rewritten_url.must_equal '/foo/bar'
|
34
39
|
end
|
35
40
|
end
|
36
41
|
|
37
42
|
describe 'url_to overriden' do
|
38
43
|
it 'must return translation when persisted' do
|
39
|
-
Rewritten.add_translation('/foo/bar', '/products/123')
|
40
|
-
def @instance.polymorphic_url(
|
44
|
+
Rewritten.add_translation('/foo/bar', '/products/123')
|
45
|
+
def @instance.polymorphic_url(_object, _options = {})
|
46
|
+
'/foo/bar'
|
47
|
+
end
|
41
48
|
Rewritten.translate(@instance.rewritten_url).must_equal '/products/123'
|
42
49
|
end
|
43
50
|
end
|
44
|
-
|
45
51
|
end
|
46
52
|
|
47
53
|
it 'must return all translations as array' do
|
48
|
-
|
49
54
|
Rewritten.add_translation('/foo/bar', '/products/123')
|
50
55
|
Rewritten.add_translation('/foo/baz', '/products/123')
|
51
56
|
|
52
|
-
@instance.rewritten_urls.must_equal ['/foo/bar', '/foo/baz']
|
57
|
+
@instance.rewritten_urls.must_equal ['/foo/bar', '/foo/baz']
|
53
58
|
end
|
54
59
|
|
55
60
|
it 'must add a new translation' do
|
56
|
-
@instance.
|
57
|
-
@instance.rewritten_url = '/foo/baz'
|
61
|
+
@instance.rewritten_url?.must_equal false
|
62
|
+
@instance.rewritten_url = '/foo/baz'
|
58
63
|
Rewritten.get_current_translation('/products/123').must_equal '/foo/baz'
|
59
|
-
@instance.
|
64
|
+
@instance.rewritten_url?.must_equal true
|
60
65
|
end
|
61
66
|
|
62
67
|
it 'must remove all translation' do
|
63
|
-
@instance.rewritten_url = '/foo/bar'
|
64
|
-
@instance.rewritten_url = '/foo/baz'
|
68
|
+
@instance.rewritten_url = '/foo/bar'
|
69
|
+
@instance.rewritten_url = '/foo/baz'
|
65
70
|
@instance.remove_rewritten_urls
|
66
71
|
@instance.rewritten_urls.must_equal []
|
67
72
|
end
|
68
73
|
|
69
74
|
it 'must won\'t add blank and similar translations' do
|
70
|
-
@instance.rewritten_url = '/foo/bar'
|
75
|
+
@instance.rewritten_url = '/foo/bar'
|
71
76
|
@instance.rewritten_urls.must_equal ['/foo/bar']
|
72
77
|
@instance.rewritten_url = nil
|
73
78
|
@instance.rewritten_urls.must_equal ['/foo/bar']
|
74
|
-
@instance.rewritten_url =
|
79
|
+
@instance.rewritten_url = ''
|
75
80
|
@instance.rewritten_urls.must_equal ['/foo/bar']
|
76
|
-
@instance.rewritten_url =
|
81
|
+
@instance.rewritten_url = '/foo/bar'
|
77
82
|
@instance.rewritten_urls.must_equal ['/foo/bar']
|
78
83
|
end
|
79
|
-
|
80
84
|
end
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|