almodovar 0.5.6 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +4 -4
- data/lib/almodovar.rb +15 -181
- data/lib/almodovar/digest_auth.rb +4 -0
- data/lib/almodovar/http_accessor.rb +26 -0
- data/lib/almodovar/resource.rb +56 -0
- data/lib/almodovar/resource_collection.rb +31 -0
- data/lib/almodovar/resource_presenter.rb +110 -0
- data/lib/almodovar/resource_presenter/collection.rb +24 -0
- data/lib/almodovar/resource_presenter/link.rb +103 -0
- data/lib/almodovar/single_resource.rb +79 -0
- data/lib/almodovar/to_xml.rb +21 -0
- metadata +47 -91
- data/lib/to_xml.rb +0 -24
- data/vendor/resourceful-0.5.3-patched/MIT-LICENSE +0 -21
- data/vendor/resourceful-0.5.3-patched/Manifest +0 -29
- data/vendor/resourceful-0.5.3-patched/README.markdown +0 -84
- data/vendor/resourceful-0.5.3-patched/Rakefile +0 -71
- data/vendor/resourceful-0.5.3-patched/lib/resourceful.rb +0 -18
- data/vendor/resourceful-0.5.3-patched/lib/resourceful/authentication_manager.rb +0 -108
- data/vendor/resourceful-0.5.3-patched/lib/resourceful/cache_manager.rb +0 -240
- data/vendor/resourceful-0.5.3-patched/lib/resourceful/exceptions.rb +0 -34
- data/vendor/resourceful-0.5.3-patched/lib/resourceful/header.rb +0 -126
- data/vendor/resourceful-0.5.3-patched/lib/resourceful/http_accessor.rb +0 -98
- data/vendor/resourceful-0.5.3-patched/lib/resourceful/memcache_cache_manager.rb +0 -75
- data/vendor/resourceful-0.5.3-patched/lib/resourceful/net_http_adapter.rb +0 -70
- data/vendor/resourceful-0.5.3-patched/lib/resourceful/options_interpreter.rb +0 -78
- data/vendor/resourceful-0.5.3-patched/lib/resourceful/request.rb +0 -230
- data/vendor/resourceful-0.5.3-patched/lib/resourceful/resource.rb +0 -165
- data/vendor/resourceful-0.5.3-patched/lib/resourceful/response.rb +0 -221
- data/vendor/resourceful-0.5.3-patched/lib/resourceful/stubbed_resource_proxy.rb +0 -47
- data/vendor/resourceful-0.5.3-patched/lib/resourceful/util.rb +0 -6
- data/vendor/resourceful-0.5.3-patched/resourceful.gemspec +0 -48
- data/vendor/resourceful-0.5.3-patched/spec/acceptance/authorization_spec.rb +0 -16
- data/vendor/resourceful-0.5.3-patched/spec/acceptance/caching_spec.rb +0 -192
- data/vendor/resourceful-0.5.3-patched/spec/acceptance/header_spec.rb +0 -24
- data/vendor/resourceful-0.5.3-patched/spec/acceptance/redirecting_spec.rb +0 -12
- data/vendor/resourceful-0.5.3-patched/spec/acceptance/resource_spec.rb +0 -84
- data/vendor/resourceful-0.5.3-patched/spec/acceptance_shared_specs.rb +0 -44
- data/vendor/resourceful-0.5.3-patched/spec/old_acceptance_specs.rb +0 -378
- data/vendor/resourceful-0.5.3-patched/spec/simple_sinatra_server.rb +0 -74
- data/vendor/resourceful-0.5.3-patched/spec/simple_sinatra_server_spec.rb +0 -98
- data/vendor/resourceful-0.5.3-patched/spec/spec.opts +0 -3
- data/vendor/resourceful-0.5.3-patched/spec/spec_helper.rb +0 -28
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'resourceful/resource'
|
2
|
-
|
3
|
-
module Resourceful
|
4
|
-
class StubbedResourceProxy
|
5
|
-
def initialize(resource, canned_responses)
|
6
|
-
@resource = resource
|
7
|
-
|
8
|
-
@canned_responses = {}
|
9
|
-
|
10
|
-
canned_responses.each do |cr|
|
11
|
-
mime_type = cr[:mime_type]
|
12
|
-
@canned_responses[mime_type] = resp = Net::HTTPOK.new('1.1', '200', 'OK')
|
13
|
-
resp['content-type'] = mime_type.to_str
|
14
|
-
resp.instance_variable_set(:@read, true)
|
15
|
-
resp.instance_variable_set(:@body, cr[:body])
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def get_body(*args)
|
21
|
-
get(*args).body
|
22
|
-
end
|
23
|
-
|
24
|
-
def get(*args)
|
25
|
-
options = args.last.is_a?(Hash) ? args.last : {}
|
26
|
-
|
27
|
-
if accept = [(options[:accept] || '*/*')].flatten.compact
|
28
|
-
accept.each do |mt|
|
29
|
-
return canned_response(mt) || next
|
30
|
-
end
|
31
|
-
@resource.get(*args)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def method_missing(method, *args)
|
36
|
-
@resource.send(method, *args)
|
37
|
-
end
|
38
|
-
|
39
|
-
protected
|
40
|
-
|
41
|
-
def canned_response(mime_type)
|
42
|
-
mime_type = @canned_responses.keys.first if mime_type == '*/*'
|
43
|
-
@canned_responses[mime_type]
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.name = %q{resourceful}
|
5
|
-
s.version = "0.5.3"
|
6
|
-
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = ["Paul Sadauskas"]
|
9
|
-
s.date = %q{2009-07-15}
|
10
|
-
s.description = %q{An HTTP library for Ruby that takes advantage of everything HTTP has to offer.}
|
11
|
-
s.email = %q{psadauskas@gmail.com}
|
12
|
-
s.extra_rdoc_files = ["lib/resourceful.rb", "lib/resourceful/net_http_adapter.rb", "lib/resourceful/stubbed_resource_proxy.rb", "lib/resourceful/header.rb", "lib/resourceful/memcache_cache_manager.rb", "lib/resourceful/response.rb", "lib/resourceful/util.rb", "lib/resourceful/options_interpreter.rb", "lib/resourceful/cache_manager.rb", "lib/resourceful/request.rb", "lib/resourceful/resource.rb", "lib/resourceful/exceptions.rb", "lib/resourceful/http_accessor.rb", "lib/resourceful/authentication_manager.rb", "README.markdown"]
|
13
|
-
s.files = ["lib/resourceful.rb", "lib/resourceful/net_http_adapter.rb", "lib/resourceful/stubbed_resource_proxy.rb", "lib/resourceful/header.rb", "lib/resourceful/memcache_cache_manager.rb", "lib/resourceful/response.rb", "lib/resourceful/util.rb", "lib/resourceful/options_interpreter.rb", "lib/resourceful/cache_manager.rb", "lib/resourceful/request.rb", "lib/resourceful/resource.rb", "lib/resourceful/exceptions.rb", "lib/resourceful/http_accessor.rb", "lib/resourceful/authentication_manager.rb", "README.markdown", "MIT-LICENSE", "Rakefile", "Manifest", "spec/simple_sinatra_server_spec.rb", "spec/old_acceptance_specs.rb", "spec/acceptance_shared_specs.rb", "spec/spec_helper.rb", "spec/simple_sinatra_server.rb", "spec/acceptance/authorization_spec.rb", "spec/acceptance/header_spec.rb", "spec/acceptance/resource_spec.rb", "spec/acceptance/caching_spec.rb", "spec/acceptance/redirecting_spec.rb", "spec/spec.opts", "resourceful.gemspec"]
|
14
|
-
s.homepage = %q{http://github.com/paul/resourceful}
|
15
|
-
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Resourceful", "--main", "README.markdown"]
|
16
|
-
s.require_paths = ["lib"]
|
17
|
-
s.rubyforge_project = %q{resourceful}
|
18
|
-
s.rubygems_version = %q{1.3.3}
|
19
|
-
s.summary = %q{An HTTP library for Ruby that takes advantage of everything HTTP has to offer.}
|
20
|
-
|
21
|
-
if s.respond_to? :specification_version then
|
22
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
23
|
-
s.specification_version = 3
|
24
|
-
|
25
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
26
|
-
s.add_runtime_dependency(%q<addressable>, [">= 0"])
|
27
|
-
s.add_runtime_dependency(%q<httpauth>, [">= 0"])
|
28
|
-
s.add_development_dependency(%q<thin>, [">= 0"])
|
29
|
-
s.add_development_dependency(%q<yard>, [">= 0"])
|
30
|
-
s.add_development_dependency(%q<sinatra>, [">= 0"])
|
31
|
-
s.add_development_dependency(%q<rspec>, [">= 0"])
|
32
|
-
else
|
33
|
-
s.add_dependency(%q<addressable>, [">= 0"])
|
34
|
-
s.add_dependency(%q<httpauth>, [">= 0"])
|
35
|
-
s.add_dependency(%q<thin>, [">= 0"])
|
36
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
37
|
-
s.add_dependency(%q<sinatra>, [">= 0"])
|
38
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
39
|
-
end
|
40
|
-
else
|
41
|
-
s.add_dependency(%q<addressable>, [">= 0"])
|
42
|
-
s.add_dependency(%q<httpauth>, [">= 0"])
|
43
|
-
s.add_dependency(%q<thin>, [">= 0"])
|
44
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
45
|
-
s.add_dependency(%q<sinatra>, [">= 0"])
|
46
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
47
|
-
end
|
48
|
-
end
|
@@ -1,192 +0,0 @@
|
|
1
|
-
|
2
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
3
|
-
require 'resourceful'
|
4
|
-
require 'addressable/template'
|
5
|
-
|
6
|
-
describe Resourceful do
|
7
|
-
|
8
|
-
describe "caching" do
|
9
|
-
|
10
|
-
before do
|
11
|
-
@http = Resourceful::HttpAccessor.new(:cache_manager => Resourceful::InMemoryCacheManager.new)
|
12
|
-
if ENV['SPEC_LOGGING']
|
13
|
-
@http.logger = Resourceful::StdOutLogger.new
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def get_with_errors(resource)
|
18
|
-
begin
|
19
|
-
resp = resource.get
|
20
|
-
rescue Resourceful::UnsuccessfulHttpRequestError => e
|
21
|
-
resp = e.http_response
|
22
|
-
end
|
23
|
-
resp
|
24
|
-
end
|
25
|
-
|
26
|
-
def uri_plus_params(uri, params = {})
|
27
|
-
uri = uri.is_a?(Addressable::URI) ? uri : Addressable::URI.parse(uri)
|
28
|
-
uri.query_values = params
|
29
|
-
uri
|
30
|
-
end
|
31
|
-
|
32
|
-
def uri_for_code(code, params = {})
|
33
|
-
template = Addressable::Template.new("http://localhost:3000/code/{code}")
|
34
|
-
uri = template.expand("code" => code.to_s)
|
35
|
-
|
36
|
-
uri_plus_params(uri, params)
|
37
|
-
end
|
38
|
-
|
39
|
-
describe "response cacheability" do
|
40
|
-
Resourceful::Response::NORMALLY_CACHEABLE_RESPONSE_CODES.each do |code|
|
41
|
-
describe "response code #{code}" do
|
42
|
-
it "should normally be cached" do
|
43
|
-
resource = @http.resource(uri_for_code(code))
|
44
|
-
|
45
|
-
resp = get_with_errors(resource)
|
46
|
-
resp.should be_cacheable
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should not be cached if Vary: *" do
|
50
|
-
resource = @http.resource(uri_for_code(200, "Vary" => "*"))
|
51
|
-
|
52
|
-
resp = get_with_errors(resource)
|
53
|
-
resp.should_not be_cacheable
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should not be cached if Cache-Control: no-cache'" do
|
57
|
-
resource = @http.resource(uri_for_code(200, "Cache-Control" => "no-cache"))
|
58
|
-
|
59
|
-
resp = get_with_errors(resource)
|
60
|
-
resp.should_not be_cacheable
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
# I would prefer to do all other codes, but some of them do some magic stuff (100),
|
66
|
-
# so I'll just spot check.
|
67
|
-
[201, 206, 302, 307, 404, 500].each do |code|
|
68
|
-
describe "response code #{code}" do
|
69
|
-
it "should not normally be cached" do
|
70
|
-
resource = @http.resource(uri_for_code(code))
|
71
|
-
|
72
|
-
resp = get_with_errors(resource)
|
73
|
-
resp.should_not be_cacheable
|
74
|
-
end
|
75
|
-
|
76
|
-
it "should be cached if Cache-Control: public" do
|
77
|
-
resource = @http.resource(uri_for_code(code, "Cache-Control" => "public"))
|
78
|
-
|
79
|
-
resp = get_with_errors(resource)
|
80
|
-
resp.should be_cacheable
|
81
|
-
end
|
82
|
-
|
83
|
-
it "should be cached if Cache-Control: private" do
|
84
|
-
resource = @http.resource(uri_for_code(code, "Cache-Control" => "private"))
|
85
|
-
|
86
|
-
resp = get_with_errors(resource)
|
87
|
-
resp.should be_cacheable
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
end
|
93
|
-
|
94
|
-
describe "expiration" do
|
95
|
-
it 'should use the cached response if Expire: is in the future' do
|
96
|
-
in_the_future = (Time.now + 60).httpdate
|
97
|
-
resource = @http.resource(uri_for_code(200, "Expire" => in_the_future))
|
98
|
-
|
99
|
-
resp = resource.get
|
100
|
-
resp.should_not be_expired
|
101
|
-
|
102
|
-
resp = resource.get
|
103
|
-
resp.should be_ok
|
104
|
-
resp.should_not be_authoritative
|
105
|
-
end
|
106
|
-
|
107
|
-
it 'should revalidate the cached response if the response is expired' do
|
108
|
-
in_the_past = (Time.now - 60).httpdate
|
109
|
-
resource = @http.resource(uri_for_code(200, "Expire" => in_the_past))
|
110
|
-
|
111
|
-
resp = resource.get
|
112
|
-
resp.should be_expired
|
113
|
-
|
114
|
-
resp = resource.get
|
115
|
-
resp.should be_ok
|
116
|
-
resp.should be_authoritative
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
describe 'authoritative' do
|
121
|
-
|
122
|
-
it "should be authoritative if the response is directly from the server" do
|
123
|
-
resource = @http.resource(
|
124
|
-
uri_plus_params('http://localhost:3000/', "Cache-Control" => 'max-age=10')
|
125
|
-
)
|
126
|
-
|
127
|
-
response = resource.get
|
128
|
-
response.should be_authoritative
|
129
|
-
end
|
130
|
-
|
131
|
-
it "should be authoritative if a cached response was revalidated with the server" do
|
132
|
-
now = Time.now.httpdate
|
133
|
-
resource = @http.resource(
|
134
|
-
uri_plus_params('http://localhost:3000/cached',
|
135
|
-
"modified" => now,
|
136
|
-
"Cache-Control" => 'max-age=0')
|
137
|
-
)
|
138
|
-
|
139
|
-
resource.get
|
140
|
-
response = resource.get("Cache-Control" => "max-age=0")
|
141
|
-
response.should be_authoritative
|
142
|
-
end
|
143
|
-
|
144
|
-
it "should not be authoritative if the cached response was not revalidated" do
|
145
|
-
now = Time.now.httpdate
|
146
|
-
resource = @http.resource(
|
147
|
-
uri_plus_params('http://localhost:3000/cached',
|
148
|
-
"modified" => now,
|
149
|
-
"Cache-Control" => 'max-age=10')
|
150
|
-
)
|
151
|
-
|
152
|
-
resource.get
|
153
|
-
response = resource.get
|
154
|
-
response.should_not be_authoritative
|
155
|
-
|
156
|
-
end
|
157
|
-
|
158
|
-
end
|
159
|
-
|
160
|
-
describe "Not Modified responses" do
|
161
|
-
before do
|
162
|
-
now = Time.now.httpdate
|
163
|
-
|
164
|
-
resource = @http.resource(
|
165
|
-
uri_plus_params('http://localhost:3000/cached',
|
166
|
-
"modified" => now,
|
167
|
-
"Cache-Control" => 'max-age=0')
|
168
|
-
)
|
169
|
-
|
170
|
-
@first_response = resource.get
|
171
|
-
@second_response = resource.get("Cache-Control" => "max-age=0") # Force revalidation
|
172
|
-
end
|
173
|
-
|
174
|
-
it "should replace the 304 response with whats in the cache" do
|
175
|
-
@second_response.code.should == @first_response.code
|
176
|
-
end
|
177
|
-
|
178
|
-
it "should provide a body identical to the original response" do
|
179
|
-
@second_response.body.should == @first_response.body
|
180
|
-
end
|
181
|
-
|
182
|
-
it "should override any cached headers with new ones"
|
183
|
-
end
|
184
|
-
|
185
|
-
describe "cache invalidation" do
|
186
|
-
|
187
|
-
end
|
188
|
-
|
189
|
-
end
|
190
|
-
|
191
|
-
end
|
192
|
-
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
require 'resourceful'
|
3
|
-
|
4
|
-
describe Resourceful do
|
5
|
-
|
6
|
-
describe 'setting headers' do
|
7
|
-
before do
|
8
|
-
@http = Resourceful::HttpAccessor.new
|
9
|
-
@resource = @http.resource("http://localhost:3000/header")
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'should handle "Content-Type"' do
|
13
|
-
resp = @resource.post("asdf", :content_type => 'foo/bar')
|
14
|
-
|
15
|
-
header = YAML.load(resp.body)
|
16
|
-
|
17
|
-
header.should have_key('CONTENT_TYPE')
|
18
|
-
header['CONTENT_TYPE'].should == 'foo/bar'
|
19
|
-
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
@@ -1,84 +0,0 @@
|
|
1
|
-
|
2
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
3
|
-
require 'resourceful'
|
4
|
-
|
5
|
-
describe Resourceful do
|
6
|
-
|
7
|
-
describe "working with a resource" do
|
8
|
-
before do
|
9
|
-
@http = Resourceful::HttpAccessor.new
|
10
|
-
@resource = @http.resource('http://localhost:3000/')
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'should make the original uri available' do
|
14
|
-
@resource.effective_uri.should == 'http://localhost:3000/'
|
15
|
-
@resource.uri.should == 'http://localhost:3000/'
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'should set the user agent string on the default header' do
|
19
|
-
@resource.default_header.should have_key('User-Agent')
|
20
|
-
@resource.default_header['User-Agent'].should == Resourceful::RESOURCEFUL_USER_AGENT_TOKEN
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "GET" do
|
24
|
-
|
25
|
-
it "should be performable on a resource and return a response" do
|
26
|
-
response = @resource.get
|
27
|
-
response.should be_kind_of(Resourceful::Response)
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
describe "POST" do
|
33
|
-
|
34
|
-
it "should be performable on a resource and return a response" do
|
35
|
-
response = @resource.post
|
36
|
-
response.should be_kind_of(Resourceful::Response)
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should require Content-Type be set if a body is provided" do
|
40
|
-
lambda {
|
41
|
-
@resource.post("some text")
|
42
|
-
}.should raise_error(Resourceful::MissingContentType)
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
describe "PUT" do
|
48
|
-
|
49
|
-
it "should be performable on a resource and return a response" do
|
50
|
-
response = @resource.put(nil)
|
51
|
-
response.should be_kind_of(Resourceful::Response)
|
52
|
-
end
|
53
|
-
|
54
|
-
it "should require Content-Type be set if a body is provided" do
|
55
|
-
lambda {
|
56
|
-
@resource.put("some text")
|
57
|
-
}.should raise_error(Resourceful::MissingContentType)
|
58
|
-
end
|
59
|
-
|
60
|
-
it "should require an entity-body to be set" do
|
61
|
-
lambda {
|
62
|
-
@resource.put()
|
63
|
-
}.should raise_error(ArgumentError)
|
64
|
-
end
|
65
|
-
|
66
|
-
it "should allow the entity-body to be nil" do
|
67
|
-
lambda {
|
68
|
-
@resource.put(nil)
|
69
|
-
}.should_not raise_error(ArgumentError)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
describe "DELETE" do
|
74
|
-
|
75
|
-
it "should be performable on a resource and return a response" do
|
76
|
-
response = @resource.delete
|
77
|
-
response.should be_kind_of(Resourceful::Response)
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
|
83
|
-
end
|
84
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
describe 'redirect', :shared => true do
|
2
|
-
it 'should be followed by default on GET' do
|
3
|
-
resp = @resource.get
|
4
|
-
resp.should be_instance_of(Resourceful::Response)
|
5
|
-
resp.should be_ok
|
6
|
-
resp.header['Content-Type'].should == ['text/plain']
|
7
|
-
end
|
8
|
-
|
9
|
-
%w{PUT POST}.each do |method|
|
10
|
-
it "should not be followed by default on #{method}" do
|
11
|
-
resp = @resource.send(method.downcase.intern, nil, :content_type => 'text/plain' )
|
12
|
-
resp.should be_redirect
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should redirect on #{method.to_s.upcase} if the redirection callback returns true" do
|
16
|
-
@resource.on_redirect { true }
|
17
|
-
resp = @resource.send(method.downcase.intern, nil, :content_type => 'text/plain' )
|
18
|
-
resp.should be_ok
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should not follow redirect on #{method.to_s.upcase} if the redirection callback returns false" do
|
22
|
-
@resource.on_redirect { false }
|
23
|
-
resp = @resource.send(method.downcase.intern, nil, :content_type => 'text/plain' )
|
24
|
-
resp.should be_redirect
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should not be followed by default on DELETE" do
|
29
|
-
resp = @resource.delete
|
30
|
-
resp.should be_redirect
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should redirect on DELETE if vthe redirection callback returns true" do
|
34
|
-
@resource.on_redirect { true }
|
35
|
-
resp = @resource.delete
|
36
|
-
resp.should be_ok
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should not redirect on DELETE if the redirection callback returns false" do
|
40
|
-
resp = @resource.delete
|
41
|
-
resp.should be_redirect
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|