rack-test-rest 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/rack-test-rest.rb +11 -4
- data/rack-test-rest.gemspec +2 -2
- metadata +11 -11
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.3
|
data/lib/rack-test-rest.rb
CHANGED
@@ -15,8 +15,7 @@ module Rack
|
|
15
15
|
puts last_response.headers.inspect
|
16
16
|
puts "Body: #{last_response.body}" if @rack_test_rest[:debug]
|
17
17
|
end
|
18
|
-
|
19
|
-
assert_equal 'application/json', last_response.headers['Content-Type']
|
18
|
+
assert_content_type_is_json(last_response)
|
20
19
|
|
21
20
|
if last_response.headers['Content-Length'].to_i > 0
|
22
21
|
JSON.parse(last_response.body)
|
@@ -40,7 +39,7 @@ module Rack
|
|
40
39
|
end
|
41
40
|
|
42
41
|
assert_equal(201, last_response.status)
|
43
|
-
|
42
|
+
assert_content_type_is_json(last_response)
|
44
43
|
|
45
44
|
if @rack_test_rest[:location]
|
46
45
|
assert last_response.original_headers["Location"] =~ @rack_test_rest[:location]
|
@@ -71,7 +70,7 @@ module Rack
|
|
71
70
|
puts "Body: #{last_response.body}"
|
72
71
|
end
|
73
72
|
|
74
|
-
|
73
|
+
assert_content_type_is_json(last_response)
|
75
74
|
assert_equal(200, last_response.status)
|
76
75
|
|
77
76
|
JSON.parse(last_response.body)
|
@@ -148,6 +147,14 @@ module Rack
|
|
148
147
|
end
|
149
148
|
end
|
150
149
|
|
150
|
+
private
|
151
|
+
|
152
|
+
def assert_content_type_is_json(response)
|
153
|
+
# ignore character sets when evaluating content type
|
154
|
+
content_type = response.headers['Content-Type'].split(';')[0].strip.downcase
|
155
|
+
assert_equal 'application/json', content_type
|
156
|
+
end
|
157
|
+
|
151
158
|
end
|
152
159
|
end
|
153
160
|
end
|
data/rack-test-rest.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "rack-test-rest"
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Joseph Ruscio"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2012-01-03"
|
13
13
|
s.description = "rack-test-rest is an extension to rack-test that when combined with Test::Unit simplifies the process of unit testing properly designed RESTful API's."
|
14
14
|
s.email = "joe@ruscio.org"
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-test-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-03 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: shoulda
|
16
|
-
requirement: &
|
16
|
+
requirement: &2156487500 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2156487500
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
27
|
-
requirement: &
|
27
|
+
requirement: &2156486240 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.0.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2156486240
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: jeweler
|
38
|
-
requirement: &
|
38
|
+
requirement: &2156485080 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.5.2
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2156485080
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rcov
|
49
|
-
requirement: &
|
49
|
+
requirement: &2156484060 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2156484060
|
58
58
|
description: rack-test-rest is an extension to rack-test that when combined with Test::Unit
|
59
59
|
simplifies the process of unit testing properly designed RESTful API's.
|
60
60
|
email: joe@ruscio.org
|
@@ -90,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
90
|
version: '0'
|
91
91
|
segments:
|
92
92
|
- 0
|
93
|
-
hash:
|
93
|
+
hash: 2151896098747462731
|
94
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|