spec/optionsful_server_spec.rb in optionsful-0.5.2 vs spec/optionsful_server_spec.rb in optionsful-0.5.3
- old
+ new
@@ -47,32 +47,45 @@
before(:all) do
rails_app.routes.draw do
resources :posts
end
end
+
+ it "the /posts should allow GET and POST requests" do
+ response = http_options_request("/posts")
+ validate_response(response)
+ response[0].should be 204
+ should_allow(response[1], "GET", "POST")
+ end
it "the index action displays a list of all posts in response of a GET request" do
response = http_options_request("/posts")
validate_response(response)
response[0].should be 204
- response[1]["Allow"].should include "GET"
+ should_allow(response[1], "GET")
end
it "the new action return from a GET request an HTML form for creating a new post" do
response = http_options_request("/posts/new")
validate_response(response)
response[0].should be 204
response[1]["Allow"].should include "GET"
- response[1]["Allow"].should_not include "POST"
end
it "the create action uses POST to create a new post instance" do
response = http_options_request("/posts")
validate_response(response)
response[0].should be 204
response[1]["Allow"].should include "POST"
end
+
+ it "the entry index should allow GET, PUT and DELETE" do
+ response = http_options_request("/posts/1")
+ validate_response(response)
+ response[0].should be 204
+ should_allow(response[1], "GET", "PUT", "DELETE")
+ end
it "the show action display a specific post in response of a GET request" do
response = http_options_request("/posts/1")
validate_response(response)
response[0].should be 204
@@ -376,10 +389,10 @@
it "should work" do
response = http_options_request("/photos/chick/show/123.json")
validate_response(response)
response[0].should be 204
- response[1]["Allow"].should include "GET"
+ should_allow(response[1], "GET")
end
after(:all) do
Rails.application.reload_routes!
end