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,98 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'rubygems'
|
3
|
-
require 'sinatra'
|
4
|
-
require 'sinatra/test/rspec'
|
5
|
-
|
6
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
7
|
-
|
8
|
-
describe "GET /" do
|
9
|
-
it 'should render "Hello, world!"' do
|
10
|
-
get '/'
|
11
|
-
@response.should be_ok
|
12
|
-
@response.body.should == "Hello, world!"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "POST /" do
|
17
|
-
it 'should be 201 with no body' do
|
18
|
-
post '/'
|
19
|
-
@response.should be_ok
|
20
|
-
@response.body.should == ""
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should return the request body as the response body' do
|
24
|
-
body = "Some text"
|
25
|
-
post '/', body
|
26
|
-
@response.should be_ok
|
27
|
-
@response.body.should == body
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe "PUT /" do
|
32
|
-
it 'should be 200 with no body' do
|
33
|
-
put '/'
|
34
|
-
@response.should be_ok
|
35
|
-
@response.body.should == ""
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'should return the request body as the response body' do
|
39
|
-
body = "Some text"
|
40
|
-
put '/', body
|
41
|
-
@response.should be_ok
|
42
|
-
@response.body.should == body
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe "DELETE /" do
|
47
|
-
it 'should render "Deleted"' do
|
48
|
-
delete '/'
|
49
|
-
@response.should be_ok
|
50
|
-
@response.body.should == "Deleted"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
describe "/method" do
|
55
|
-
it 'should respond with the method used to make the request' do
|
56
|
-
%w[get post put delete].each do |verb|
|
57
|
-
send verb, '/method'
|
58
|
-
@response.body.should == verb.upcase
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe "/code/nnn" do
|
64
|
-
it 'should respond with the code provided in the url' do
|
65
|
-
# Just try a handful
|
66
|
-
[200, 201, 301, 302, 304, 403, 404, 500].each do |code|
|
67
|
-
get "/code/#{code}"
|
68
|
-
@response.status.should == code
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
describe "/header" do
|
74
|
-
it 'should set response headers from the query string' do
|
75
|
-
get "/header", "X-Foo" => "Bar"
|
76
|
-
@response['X-Foo'].should == "Bar"
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'should dump the request headers into the body as yaml' do
|
80
|
-
get '/header', {}, "X-Foo" => "Bar"
|
81
|
-
body = YAML.load(@response.body)
|
82
|
-
body['X-Foo'].should == "Bar"
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe "/cache" do
|
87
|
-
it 'should be normal 200 if the modified query param and the ims header dont match' do
|
88
|
-
now = Time.now
|
89
|
-
get '/cached', {"modified" => now.httpdate}, {"HTTP_IF_MODIFIED_SINCE" => (now - 3600).httpdate}
|
90
|
-
@response.should be_ok
|
91
|
-
end
|
92
|
-
|
93
|
-
it 'should be 304 if the modified query param and the ims header are the same' do
|
94
|
-
now = Time.now
|
95
|
-
get '/cached', {"modified" => now.httpdate}, {"HTTP_IF_MODIFIED_SINCE" => now.httpdate}
|
96
|
-
@response.status.should == 304
|
97
|
-
end
|
98
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'spec'
|
3
|
-
|
4
|
-
$LOAD_PATH << File.join(File.dirname(__FILE__), "..", "lib")
|
5
|
-
require 'resourceful'
|
6
|
-
|
7
|
-
$LOAD_PATH << File.dirname(__FILE__) # ./spec
|
8
|
-
|
9
|
-
# Spawn the server in another process
|
10
|
-
|
11
|
-
@server = Thread.new do
|
12
|
-
|
13
|
-
require 'simple_sinatra_server'
|
14
|
-
Sinatra::Default.set(
|
15
|
-
:run => true,
|
16
|
-
:logging => false
|
17
|
-
)
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
# Kill the server process when rspec finishes
|
22
|
-
at_exit { @server.exit }
|
23
|
-
|
24
|
-
|
25
|
-
# Give the app a change to initialize
|
26
|
-
$stderr.puts "Waiting for thin to initialize..."
|
27
|
-
sleep 0.2
|
28
|
-
|