rspec-http 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +0 -10
- data/LICENCE +2 -1
- data/README.rdoc +16 -14
- data/lib/rspec/http/header_matchers.rb +6 -6
- data/lib/rspec/http/response_code_matcher.rb +1 -1
- data/lib/rspec/http/version.rb +1 -1
- data/rspec-http.gemspec +4 -3
- data/spec/rspec/http/header_matchers_spec.rb +4 -0
- data/spec/spec_helper.rb +1 -5
- metadata +45 -21
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d4839503a437b74af0a45eb0c94f26c8da34f2fb
|
4
|
+
data.tar.gz: 88b8af6fbaff0b8c9166256e1e50ffe12865e9d7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c6a0b48935943e51608d1122efccaf6d26eae8d2adaedf5d12fcc5cd2f6cddba95a1fd30119dc4aef99e445a6f2bb96d9d3077541fbc26d99736841a2ae61565
|
7
|
+
data.tar.gz: afc34dea4675c03edb86e3405997b76b30428ddd06c76acbf44fc5fb417b2085c5262ff8f0a32a68f5be3b5741388e0c6f1d5da028351be1418d3e1d29104e90
|
data/Gemfile
CHANGED
@@ -1,13 +1,3 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
-
gem "rack", "~> 1.0"
|
4
|
-
gem "ruby-debug", :platforms => [:ruby_18, :jruby]
|
5
|
-
gem "ruby-debug19", :platforms => :ruby_19
|
6
|
-
gem "rcov", :platforms => :ruby_18
|
7
|
-
gem "rake", "~> 0.9.2"
|
8
|
-
|
9
|
-
platforms :jruby do
|
10
|
-
gem "jruby-openssl"
|
11
|
-
end
|
12
|
-
|
13
3
|
gemspec
|
data/LICENCE
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
Copyright 2011 C42 Engineering India Pvt. Ltd.
|
1
|
+
Copyright 2011-2014 C42 Engineering India Pvt. Ltd.
|
2
|
+
|
2
3
|
Licensed under the Apache License, Version 2.0 (the "License");
|
3
4
|
you may not use this file except in compliance with the License.
|
4
5
|
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
data/README.rdoc
CHANGED
@@ -1,39 +1,41 @@
|
|
1
|
-
= RSpec HTTP 0.
|
1
|
+
= RSpec HTTP 0.11.0
|
2
2
|
|
3
3
|
(c) Copyright 2010-2011 {C42 Engineering}[http://c42.in]. All Rights Reserved.
|
4
4
|
|
5
5
|
RSpec HTTP is a RSpec extension library that adds support for writing specs that cover HTTP based APIs (or more popularly, RESTful APIs).
|
6
6
|
|
7
7
|
To use this library, first add the rspec-http gem to your Gemfile like so:
|
8
|
-
gem 'rspec-http'
|
8
|
+
gem 'rspec-http'
|
9
9
|
|
10
10
|
Then add the following line to your spec_helper.rb:
|
11
11
|
require 'rspec/http'
|
12
12
|
|
13
13
|
This will make matchers such as the ones listed below available to you in your specs.
|
14
14
|
|
15
|
-
response.
|
15
|
+
expect(response).to be_http_ok
|
16
16
|
|
17
|
-
response.
|
17
|
+
expect(response).to be_http_created
|
18
18
|
|
19
|
-
response.
|
19
|
+
expect(response).to be_http_unprocessable_entity
|
20
20
|
|
21
|
-
response.
|
21
|
+
expect(response).to be_http_im_a_teapot
|
22
22
|
|
23
|
-
response.
|
23
|
+
expect(response).to have_header('Content-Type')
|
24
24
|
|
25
|
-
response.
|
25
|
+
expect(response).to have_header('Content-Type' => 'application/json')
|
26
26
|
|
27
|
-
response.
|
27
|
+
expect(response).to have_header('Content-Type' => /json/)
|
28
28
|
|
29
29
|
== Rails
|
30
30
|
|
31
|
-
If you're using Rails (and implicitly, rspec-rails), the same http code matchers will also be available in your controller specs *without* the <code>http</code> namespace.
|
31
|
+
If you're using Rails (and implicitly, rspec-rails), the same http code matchers will also be available in your controller specs *without* the <code>http</code> namespace.
|
32
32
|
|
33
|
-
|
33
|
+
In other words, in your controller specs you can do:
|
34
34
|
|
35
|
-
response.
|
35
|
+
expect(response).to be_ok
|
36
36
|
|
37
|
-
response.
|
37
|
+
expect(response).to be_created
|
38
38
|
|
39
|
-
response.
|
39
|
+
expect(response).to be_unprocessable_entity
|
40
|
+
|
41
|
+
expect(response).to be_im_a_teapot
|
@@ -30,8 +30,8 @@ module RSpec
|
|
30
30
|
@matcher.failure_message
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
34
|
-
@matcher.
|
33
|
+
def failure_message_when_negated
|
34
|
+
@matcher.failure_message_when_negated
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -58,7 +58,7 @@ module RSpec
|
|
58
58
|
"The header '#{header}' was not found"
|
59
59
|
end
|
60
60
|
|
61
|
-
def
|
61
|
+
def failure_message_when_negated
|
62
62
|
"The header '#{header}' should not have been found, but it was and it has a value of '#{response[header]}'"
|
63
63
|
end
|
64
64
|
end
|
@@ -70,7 +70,7 @@ module RSpec
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def validate
|
73
|
-
expected_value == response[header]
|
73
|
+
expected_value.downcase == response[header].downcase
|
74
74
|
end
|
75
75
|
|
76
76
|
def description
|
@@ -81,7 +81,7 @@ module RSpec
|
|
81
81
|
"Expected the response header '#{header}' to have a value of '#{expected_value}' but it was '#{@response[header]}'"
|
82
82
|
end
|
83
83
|
|
84
|
-
def
|
84
|
+
def failure_message_when_negated
|
85
85
|
"Expected the response header '#{header}' to have a value that is not '#{expected_value}'"
|
86
86
|
end
|
87
87
|
end
|
@@ -104,7 +104,7 @@ module RSpec
|
|
104
104
|
"Expected the response header '#{header}' to have a value that matched #{expected_value.inspect} but it was '#{@response[header]}'"
|
105
105
|
end
|
106
106
|
|
107
|
-
def
|
107
|
+
def failure_message_when_negated
|
108
108
|
"Expected the response header '#{header}' to have a value that does not match #{expected_value.inspect} but it was '#{@response[header]}'"
|
109
109
|
end
|
110
110
|
end
|
data/lib/rspec/http/version.rb
CHANGED
data/rspec-http.gemspec
CHANGED
@@ -12,14 +12,15 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.summary = "RSpec HTTP is an extension library that makes it easier to write specs for HTTP/REST APIs"
|
13
13
|
s.description = "RSpec HTTP is an extension library that makes it easier to write specs for HTTP/REST APIs"
|
14
14
|
|
15
|
-
s.rubygems_version = "1.3.7"
|
16
|
-
|
17
15
|
s.files = `git ls-files`.split("\n") - ['.gitignore']
|
18
16
|
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
19
17
|
s.extra_rdoc_files = [ "README.rdoc" ]
|
20
18
|
s.rdoc_options = ["--charset=UTF-8"]
|
21
19
|
s.require_path = "lib"
|
22
20
|
|
23
|
-
s.
|
21
|
+
s.add_development_dependency "rake"
|
22
|
+
|
23
|
+
s.add_runtime_dependency "rspec", "~> 3.0"
|
24
|
+
s.add_runtime_dependency "rack", "~> 1.0"
|
24
25
|
end
|
25
26
|
|
@@ -39,6 +39,10 @@ module RSpec::Http
|
|
39
39
|
response.should have_header("Content-Type" => "text/plain")
|
40
40
|
end
|
41
41
|
|
42
|
+
it "passes if matching is incasesensitve" do
|
43
|
+
response.should have_header("Content-Type" => "Text/Plain")
|
44
|
+
end
|
45
|
+
|
42
46
|
context "incorrect value" do
|
43
47
|
it "fails if the value is incorrect" do
|
44
48
|
response.should_not have_header("Content-Type" => "text/csv")
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.11.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Sidu Ponnappa
|
@@ -10,19 +9,50 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2014-12-18 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
15
28
|
- !ruby/object:Gem::Dependency
|
16
29
|
name: rspec
|
17
|
-
requirement:
|
18
|
-
none: false
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
19
31
|
requirements:
|
20
|
-
- - ~>
|
32
|
+
- - "~>"
|
21
33
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
34
|
+
version: '3.0'
|
23
35
|
type: :runtime
|
24
36
|
prerelease: false
|
25
|
-
version_requirements:
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '3.0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rack
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '1.0'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '1.0'
|
26
56
|
description: RSpec HTTP is an extension library that makes it easier to write specs
|
27
57
|
for HTTP/REST APIs
|
28
58
|
email: ckponnappa@gmail.com
|
@@ -52,34 +82,28 @@ files:
|
|
52
82
|
- spec/support/matchers.rb
|
53
83
|
homepage: http://c42.in/open_source
|
54
84
|
licenses: []
|
85
|
+
metadata: {}
|
55
86
|
post_install_message:
|
56
87
|
rdoc_options:
|
57
|
-
- --charset=UTF-8
|
88
|
+
- "--charset=UTF-8"
|
58
89
|
require_paths:
|
59
90
|
- lib
|
60
91
|
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
-
none: false
|
62
92
|
requirements:
|
63
|
-
- -
|
93
|
+
- - ">="
|
64
94
|
- !ruby/object:Gem::Version
|
65
95
|
version: '0'
|
66
|
-
segments:
|
67
|
-
- 0
|
68
|
-
hash: -941351284999052965
|
69
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
-
none: false
|
71
97
|
requirements:
|
72
|
-
- -
|
98
|
+
- - ">="
|
73
99
|
- !ruby/object:Gem::Version
|
74
100
|
version: '0'
|
75
|
-
segments:
|
76
|
-
- 0
|
77
|
-
hash: -941351284999052965
|
78
101
|
requirements: []
|
79
102
|
rubyforge_project:
|
80
|
-
rubygems_version:
|
103
|
+
rubygems_version: 2.2.2
|
81
104
|
signing_key:
|
82
|
-
specification_version:
|
105
|
+
specification_version: 4
|
83
106
|
summary: RSpec HTTP is an extension library that makes it easier to write specs for
|
84
107
|
HTTP/REST APIs
|
85
108
|
test_files: []
|
109
|
+
has_rdoc:
|