rewritten 0.8.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rewritten/version.rb +1 -1
- data/lib/rewritten.rb +0 -1
- data/test/rack/rewritten_url_test.rb +8 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 209d70c9a3b200f7541f26509e60f3606869fd94
|
4
|
+
data.tar.gz: a1bb41ce3c1da38d98912211b9e894f50f987d95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca36c2bd7e90bb093adabd289195c197477ef3a89feb6782e46f559054889ee2cd06f08f96dd8849e54bd68c078eff307e23f4e504c2c949d52c341e2954dc14
|
7
|
+
data.tar.gz: cd854f0f45cf703d7310881c9cf9bf1a91bddd1d628df6ab62a95ff899462984fd88458dc1fa3bfc9815215cab2290c8b74a7c34628910aee15db7a35e12c671
|
data/lib/rewritten/version.rb
CHANGED
data/lib/rewritten.rb
CHANGED
@@ -12,8 +12,8 @@ describe Rack::Rewritten::Url do
|
|
12
12
|
'rack.url_scheme' => 'http'}.merge(overrides)
|
13
13
|
end
|
14
14
|
|
15
|
-
def request_url(url)
|
16
|
-
call_args.merge('REQUEST_URI' => url, 'PATH_INFO' => url )
|
15
|
+
def request_url(url, params={})
|
16
|
+
call_args.merge({'REQUEST_URI' => url, 'PATH_INFO' => url}.merge(params) )
|
17
17
|
end
|
18
18
|
|
19
19
|
before {
|
@@ -40,14 +40,14 @@ describe Rack::Rewritten::Url do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it "must 301 redirect from old translation to latest translation" do
|
43
|
-
ret = @rack.call
|
43
|
+
ret = @rack.call request_url('/foo/bar')
|
44
44
|
@app.verify
|
45
45
|
ret[0].must_equal 301
|
46
46
|
ret[1]['Location'].must_equal "http://www.example.org/foo/baz"
|
47
47
|
end
|
48
48
|
|
49
49
|
it "must keep the query parameters in the 301 redirect" do
|
50
|
-
ret = @rack.call
|
50
|
+
ret = @rack.call request_url('/foo/bar', 'QUERY_STRING' => 'w=1')
|
51
51
|
@app.verify
|
52
52
|
ret[0].must_equal 301
|
53
53
|
ret[1]['Location'].must_equal "http://www.example.org/foo/baz?w=1"
|
@@ -55,7 +55,7 @@ describe Rack::Rewritten::Url do
|
|
55
55
|
|
56
56
|
it "must stay on latest translation" do
|
57
57
|
@app.expect :call, [200, {'Content-Type' => 'text/plain'},[""]], [Hash]
|
58
|
-
ret = @rack.call
|
58
|
+
ret = @rack.call request_url('/foo/baz')
|
59
59
|
@app.verify
|
60
60
|
ret[0].must_equal 200
|
61
61
|
end
|
@@ -64,7 +64,7 @@ describe Rack::Rewritten::Url do
|
|
64
64
|
|
65
65
|
it "must not redirect from resource url to nice url by default" do
|
66
66
|
@app.expect :call, [200, {'Content-Type' => 'text/plain'},[""]], [Hash]
|
67
|
-
ret = @rack.call
|
67
|
+
ret = @rack.call request_url('/products/1')
|
68
68
|
@app.verify
|
69
69
|
ret[0].must_equal 200
|
70
70
|
end
|
@@ -74,7 +74,7 @@ describe Rack::Rewritten::Url do
|
|
74
74
|
self.translate_backwards = true
|
75
75
|
end
|
76
76
|
|
77
|
-
ret = @rack.call
|
77
|
+
ret = @rack.call request_url('/products/1')
|
78
78
|
@app.verify
|
79
79
|
ret[0].must_equal 301
|
80
80
|
ret[1]['Location'].must_equal "http://www.example.org/foo/baz"
|
@@ -105,7 +105,7 @@ describe Rack::Rewritten::Url do
|
|
105
105
|
end
|
106
106
|
|
107
107
|
it "must redirect for other entries" do
|
108
|
-
ret = @rack.call
|
108
|
+
ret = @rack.call request_url('/no/flags')
|
109
109
|
@app.verify
|
110
110
|
ret[0].must_equal 301
|
111
111
|
ret[1]['Location'].must_equal "http://www.example.org/final/line"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rewritten
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kai Rubarth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis-namespace
|