optionsful 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/README.textile +28 -9
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/optionsful.gemspec +6 -6
- data/spec/optionsful_server_spec.rb +16 -3
- data/spec/spec_helper.rb +14 -3
- metadata +6 -6
- data/spec/spec.opts +0 -1
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color -f d
|
data/README.textile
CHANGED
@@ -63,7 +63,7 @@ h1. INSTALLATION:
|
|
63
63
|
<pre>$ gem install optionsful</pre>
|
64
64
|
# Enjoy! And give feedback! :)
|
65
65
|
|
66
|
-
h1. CONFIGURATION
|
66
|
+
h1. CONFIGURATION:
|
67
67
|
|
68
68
|
h2. Setting up the @Link@ header
|
69
69
|
|
@@ -71,13 +71,17 @@ h2. Setting up the @Link@ header
|
|
71
71
|
** run @rake optionsful:yml@
|
72
72
|
** edit the 'optionsful.yml' file at your application's 'config' folder.
|
73
73
|
* Example:
|
74
|
-
<pre>development:
|
75
|
-
link: true
|
76
|
-
host: auto
|
77
|
-
base_path: /api
|
78
|
-
propagate: true</pre>
|
79
74
|
|
80
|
-
|
75
|
+
<pre>
|
76
|
+
development:
|
77
|
+
link: true
|
78
|
+
host: auto
|
79
|
+
base_path: /api
|
80
|
+
propagate: true
|
81
|
+
</pre>
|
82
|
+
|
83
|
+
|
84
|
+
h2. Possible values and effects: (the underlined values are the default ones)
|
81
85
|
|
82
86
|
* @link@
|
83
87
|
** [+false+]: Do not include the "Link" in the response headers.
|
@@ -110,11 +114,26 @@ h2. Possible values and effects: (the underline values are the default ones)
|
|
110
114
|
h2. KNOWN ISSUES
|
111
115
|
* Rails route recognition still need some work
|
112
116
|
|
113
|
-
h2.
|
117
|
+
h2. Developer notes
|
114
118
|
|
115
|
-
|
119
|
+
<pre>
|
120
|
+
$ cd ~/your_workspace
|
121
|
+
$ git clone git@github.com:kayaman/optionsful.git
|
122
|
+
$ cd optionsful
|
123
|
+
$ rake
|
124
|
+
</pre>
|
125
|
+
|
126
|
+
* To bleed on the edge, add at your Rails 3 application's @Gemfile@:
|
116
127
|
<pre>gem 'optionsful', :path => "~/your_workspace/optionsful/"</pre>
|
117
128
|
|
129
|
+
* TODO: check dependencies.
|
130
|
+
|
131
|
+
h2. TODOs
|
132
|
+
|
133
|
+
* RSpec 2.0 => http://github.com/rspec/rspec-core/blob/master/Upgrade.markdown
|
134
|
+
* spec_helper allow_only(headers, *method)
|
135
|
+
|
136
|
+
|
118
137
|
h2. Get involved
|
119
138
|
* Mailing list: http://groups.google.com/group/optionsful
|
120
139
|
* Bug tracker : http://kayaman.lighthouseapp.com/projects/56438-optionsful/overview
|
data/Rakefile
CHANGED
@@ -13,7 +13,7 @@ begin
|
|
13
13
|
gem.rubyforge_project = "optionsful"
|
14
14
|
gem.add_development_dependency "rspec", ">= 1.2.9"
|
15
15
|
gem.add_development_dependency "yard", ">= 0"
|
16
|
-
gem.add_dependency "rails", "
|
16
|
+
gem.add_dependency "rails", ">= 3.0.0"
|
17
17
|
end
|
18
18
|
Jeweler::GemcutterTasks.new
|
19
19
|
Jeweler::RubyforgeTasks.new do |rubyforge|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.3
|
data/optionsful.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{optionsful}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Marco Antonio Gonzalez Junior"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-11-29}
|
13
13
|
s.description = %q{Build RESTful web services supporting the HTTP OPTIONS verb on Ruby on Rails applications.}
|
14
14
|
s.email = %q{kayaman@baurets.net}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
".autotest",
|
21
21
|
".document",
|
22
22
|
".gitignore",
|
23
|
+
".rspec",
|
23
24
|
"LICENSE",
|
24
25
|
"README.textile",
|
25
26
|
"Rakefile",
|
@@ -40,7 +41,6 @@ Gem::Specification.new do |s|
|
|
40
41
|
"spec/fake_app.rb",
|
41
42
|
"spec/optionsful_configurator_spec.rb",
|
42
43
|
"spec/optionsful_server_spec.rb",
|
43
|
-
"spec/spec.opts",
|
44
44
|
"spec/spec_helper.rb",
|
45
45
|
"tasks/optionsful.rake"
|
46
46
|
]
|
@@ -64,16 +64,16 @@ Gem::Specification.new do |s|
|
|
64
64
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
65
65
|
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
66
66
|
s.add_development_dependency(%q<yard>, [">= 0"])
|
67
|
-
s.add_runtime_dependency(%q<rails>, ["
|
67
|
+
s.add_runtime_dependency(%q<rails>, [">= 3.0.0"])
|
68
68
|
else
|
69
69
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
70
70
|
s.add_dependency(%q<yard>, [">= 0"])
|
71
|
-
s.add_dependency(%q<rails>, ["
|
71
|
+
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
72
72
|
end
|
73
73
|
else
|
74
74
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
75
75
|
s.add_dependency(%q<yard>, [">= 0"])
|
76
|
-
s.add_dependency(%q<rails>, ["
|
76
|
+
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -49,12 +49,19 @@ describe "Optionsful" do
|
|
49
49
|
resources :posts
|
50
50
|
end
|
51
51
|
end
|
52
|
+
|
53
|
+
it "the /posts should allow GET and POST requests" do
|
54
|
+
response = http_options_request("/posts")
|
55
|
+
validate_response(response)
|
56
|
+
response[0].should be 204
|
57
|
+
should_allow(response[1], "GET", "POST")
|
58
|
+
end
|
52
59
|
|
53
60
|
it "the index action displays a list of all posts in response of a GET request" do
|
54
61
|
response = http_options_request("/posts")
|
55
62
|
validate_response(response)
|
56
63
|
response[0].should be 204
|
57
|
-
response[1]
|
64
|
+
should_allow(response[1], "GET")
|
58
65
|
end
|
59
66
|
|
60
67
|
it "the new action return from a GET request an HTML form for creating a new post" do
|
@@ -62,7 +69,6 @@ describe "Optionsful" do
|
|
62
69
|
validate_response(response)
|
63
70
|
response[0].should be 204
|
64
71
|
response[1]["Allow"].should include "GET"
|
65
|
-
response[1]["Allow"].should_not include "POST"
|
66
72
|
end
|
67
73
|
|
68
74
|
it "the create action uses POST to create a new post instance" do
|
@@ -71,6 +77,13 @@ describe "Optionsful" do
|
|
71
77
|
response[0].should be 204
|
72
78
|
response[1]["Allow"].should include "POST"
|
73
79
|
end
|
80
|
+
|
81
|
+
it "the entry index should allow GET, PUT and DELETE" do
|
82
|
+
response = http_options_request("/posts/1")
|
83
|
+
validate_response(response)
|
84
|
+
response[0].should be 204
|
85
|
+
should_allow(response[1], "GET", "PUT", "DELETE")
|
86
|
+
end
|
74
87
|
|
75
88
|
it "the show action display a specific post in response of a GET request" do
|
76
89
|
response = http_options_request("/posts/1")
|
@@ -378,7 +391,7 @@ describe "Optionsful" do
|
|
378
391
|
response = http_options_request("/photos/chick/show/123.json")
|
379
392
|
validate_response(response)
|
380
393
|
response[0].should be 204
|
381
|
-
response[1]
|
394
|
+
should_allow(response[1], "GET")
|
382
395
|
end
|
383
396
|
|
384
397
|
after(:all) do
|
data/spec/spec_helper.rb
CHANGED
@@ -6,8 +6,8 @@ require 'optionsful'
|
|
6
6
|
require 'server'
|
7
7
|
require 'introspections'
|
8
8
|
|
9
|
-
require '
|
10
|
-
|
9
|
+
require 'rspec'
|
10
|
+
|
11
11
|
require 'fake_app'
|
12
12
|
require 'rubygems'
|
13
13
|
|
@@ -17,7 +17,7 @@ require 'rack/test'
|
|
17
17
|
require 'rack/lobster'
|
18
18
|
require 'fileutils'
|
19
19
|
|
20
|
-
|
20
|
+
RSpec.configure do |config|
|
21
21
|
|
22
22
|
end
|
23
23
|
|
@@ -69,6 +69,17 @@ DEFAULT_ENV = { "rack.version" => Rack::VERSION, "rack.input" => StringIO.new, "
|
|
69
69
|
headers["Allow"].include?(method)
|
70
70
|
end
|
71
71
|
|
72
|
+
def should_allow(headers, *method)
|
73
|
+
methods = method
|
74
|
+
allow = headers["Allow"].gsub(',', ' ')
|
75
|
+
methods.each do |m|
|
76
|
+
allow.include?(m)
|
77
|
+
allow.gsub!(m, '')
|
78
|
+
end
|
79
|
+
allow.gsub(' ', '')
|
80
|
+
return allow.empty?
|
81
|
+
end
|
82
|
+
|
72
83
|
def validate_response(response)
|
73
84
|
response.should be_a_kind_of Array
|
74
85
|
response.size.should == 3
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: optionsful
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 3
|
10
|
+
version: 0.5.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Marco Antonio Gonzalez Junior
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-11-29 00:00:00 -02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
requirement: &id003 !ruby/object:Gem::Requirement
|
55
55
|
none: false
|
56
56
|
requirements:
|
57
|
-
- - "
|
57
|
+
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
hash: 7
|
60
60
|
segments:
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- .autotest
|
78
78
|
- .document
|
79
79
|
- .gitignore
|
80
|
+
- .rspec
|
80
81
|
- LICENSE
|
81
82
|
- README.textile
|
82
83
|
- Rakefile
|
@@ -97,7 +98,6 @@ files:
|
|
97
98
|
- spec/fake_app.rb
|
98
99
|
- spec/optionsful_configurator_spec.rb
|
99
100
|
- spec/optionsful_server_spec.rb
|
100
|
-
- spec/spec.opts
|
101
101
|
- spec/spec_helper.rb
|
102
102
|
- tasks/optionsful.rake
|
103
103
|
has_rdoc: true
|
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color --debugger
|