aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/spec_helper.rb5
-rw-r--r--spec/unit/request/patch_spec.rb8
2 files changed, 9 insertions, 4 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 4a47041..c5605ef 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -40,6 +40,7 @@ class EnvGenerator
KEY_REQUEST_POST = 'POST'
KEY_REQUEST_PUT = 'PUT'
KEY_REQUEST_DELETE = 'DELETE'
+ KEY_REQUEST_PATCH = 'PATCH'
def self.generate_env(uri, options)
Rack::MockRequest.env_for(uri, options)
@@ -64,4 +65,8 @@ class EnvGenerator
def self.delete(uri, options = {})
generate_env(uri, options.merge(KEY_REQUEST_METHOD => KEY_REQUEST_DELETE))
end
+
+ def self.patch(uri, options = {})
+ generate_env(uri, options.merge(KEY_REQUEST_METHOD => KEY_REQUEST_PATCH))
+ end
end
diff --git a/spec/unit/request/patch_spec.rb b/spec/unit/request/patch_spec.rb
index 1c2d3c9..ae0d2db 100644
--- a/spec/unit/request/patch_spec.rb
+++ b/spec/unit/request/patch_spec.rb
@@ -3,13 +3,13 @@ require 'spec_helper'
describe Zero::Request, '#patch?' do
subject { Zero::Request.new(env) }
- context "with a post request" do
- let(:env) { EnvGenerator.post('/foo') }
- its(:post?) { should be(true) }
+ context "with a patch request" do
+ let(:env) { EnvGenerator.patch('/foo') }
+ its(:patch?) { should be(true) }
end
context "with a get request" do
let(:env) { EnvGenerator.get('/foo') }
- its(:post?) { should be(false) }
+ its(:patch?) { should be(false) }
end
end