response 0.0.3 → 0.0.4
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 +4 -4
- data/.travis.yml +0 -1
- data/Gemfile.devtools +19 -24
- data/config/mutant.yml +1 -1
- data/lib/response/html.rb +3 -3
- data/lib/response/json.rb +4 -4
- data/lib/response/redirect.rb +5 -6
- data/lib/response/text.rb +4 -5
- data/lib/response/xml.rb +4 -4
- data/lib/response.rb +18 -14
- data/response.gemspec +6 -6
- data/spec/unit/response/body_spec.rb +1 -1
- data/spec/unit/response/cache_control_spec.rb +1 -1
- data/spec/unit/response/class_methods/build_spec.rb +1 -1
- data/spec/unit/response/content_type_spec.rb +1 -1
- data/spec/unit/response/headers_spec.rb +1 -1
- data/spec/unit/response/html/class_methods/build_spec.rb +1 -1
- data/spec/unit/response/json/class_methods/build_spec.rb +2 -2
- data/spec/unit/response/merge_headers_spec.rb +2 -2
- data/spec/unit/response/rack_array_spec.rb +2 -2
- data/spec/unit/response/redirect/class_methods/build_spec.rb +4 -4
- data/spec/unit/response/status_spec.rb +1 -1
- data/spec/unit/response/text/class_methods/build_spec.rb +1 -1
- data/spec/unit/response/to_rack_response_spec.rb +2 -2
- data/spec/unit/response/valid_predicate_spec.rb +2 -2
- data/spec/unit/response/with_body_spec.rb +3 -3
- data/spec/unit/response/with_headers_spec.rb +3 -3
- data/spec/unit/response/with_status_spec.rb +4 -4
- data/spec/unit/response/xml/class_methods/build_spec.rb +2 -2
- metadata +12 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2df2679f6688ba11f2c48d6ea83f4aa844b74509
|
|
4
|
+
data.tar.gz: 12a33786958b3267a207a2c48bd24da61297f945
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d760eb7961469ba60a98339c61286445706ecb0c62f5919b66c9232176eadc11a6a0a88835bed905083c1f90f66a256fc510d2a098def75ac77219f4a763ac67
|
|
7
|
+
data.tar.gz: 086b4bf3bc5239e7f6639af630258592a44ba871f49c466d68c2d3e9b0be036f82dac5ef84d8737621b41510db27a5f98ef3dab372cb3a997e0a5bf25dbccda5
|
data/.travis.yml
CHANGED
data/Gemfile.devtools
CHANGED
|
@@ -2,50 +2,45 @@
|
|
|
2
2
|
|
|
3
3
|
group :development do
|
|
4
4
|
gem 'rake', '~> 10.1.0'
|
|
5
|
-
gem 'rspec', '~> 2.
|
|
6
|
-
gem 'yard', '~> 0.8.
|
|
5
|
+
gem 'rspec', '~> 2.14.1'
|
|
6
|
+
gem 'yard', '~> 0.8.7'
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
group :yard do
|
|
10
|
-
gem 'kramdown', '~> 1.0
|
|
10
|
+
gem 'kramdown', '~> 1.2.0'
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
group :guard do
|
|
14
14
|
gem 'guard', '~> 1.8.1'
|
|
15
15
|
gem 'guard-bundler', '~> 1.0.0'
|
|
16
16
|
gem 'guard-rspec', '~> 3.0.2'
|
|
17
|
+
gem 'guard-rubocop', '~> 0.2.0'
|
|
18
|
+
gem 'guard-mutant', '~> 0.0.1'
|
|
17
19
|
|
|
18
20
|
# file system change event handling
|
|
19
|
-
gem 'listen', '~> 1.
|
|
20
|
-
gem 'rb-fchange', '~> 0.0.6', :
|
|
21
|
-
gem 'rb-fsevent', '~> 0.9.3', :
|
|
22
|
-
gem 'rb-inotify', '~> 0.9.0', :
|
|
21
|
+
gem 'listen', '~> 1.3.0'
|
|
22
|
+
gem 'rb-fchange', '~> 0.0.6', require: false
|
|
23
|
+
gem 'rb-fsevent', '~> 0.9.3', require: false
|
|
24
|
+
gem 'rb-inotify', '~> 0.9.0', require: false
|
|
23
25
|
|
|
24
26
|
# notification handling
|
|
25
|
-
gem 'libnotify', '~> 0.8.0', :
|
|
26
|
-
gem 'rb-notifu', '~> 0.0.4', :
|
|
27
|
-
gem 'terminal-notifier-guard', '~> 1.5.3', :
|
|
27
|
+
gem 'libnotify', '~> 0.8.0', require: false
|
|
28
|
+
gem 'rb-notifu', '~> 0.0.4', require: false
|
|
29
|
+
gem 'terminal-notifier-guard', '~> 1.5.3', require: false
|
|
28
30
|
end
|
|
29
31
|
|
|
30
32
|
group :metrics do
|
|
31
|
-
gem 'backports', '~> 3.3', '>= 3.3.2'
|
|
32
33
|
gem 'coveralls', '~> 0.6.7'
|
|
33
|
-
gem 'flay', '~> 2.
|
|
34
|
-
gem 'flog', '~> 4.1.
|
|
35
|
-
gem 'reek', '~> 1.3.
|
|
34
|
+
gem 'flay', '~> 2.4.0'
|
|
35
|
+
gem 'flog', '~> 4.1.1'
|
|
36
|
+
gem 'reek', '~> 1.3.2'
|
|
37
|
+
gem 'rubocop', '~> 0.13.0'
|
|
36
38
|
gem 'simplecov', '~> 0.7.1'
|
|
37
|
-
gem 'yardstick', '~> 0.9.
|
|
38
|
-
|
|
39
|
-
platforms :ruby_19 do
|
|
40
|
-
gem 'yard-spellcheck', '~> 0.1.5'
|
|
41
|
-
end
|
|
39
|
+
gem 'yardstick', '~> 0.9.7', git: 'https://github.com/dkubb/yardstick.git'
|
|
42
40
|
|
|
43
41
|
platforms :ruby_19, :ruby_20 do
|
|
44
|
-
gem 'mutant', '
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
platforms :rbx do
|
|
48
|
-
gem 'pelusa', '~> 0.2.2'
|
|
42
|
+
gem 'mutant', git: 'https://github.com/mbj/mutant.git'
|
|
43
|
+
gem 'yard-spellcheck', '~> 0.1.5'
|
|
49
44
|
end
|
|
50
45
|
end
|
|
51
46
|
|
data/config/mutant.yml
CHANGED
data/lib/response/html.rb
CHANGED
|
@@ -8,11 +8,10 @@ class Response
|
|
|
8
8
|
# @param [Object] body
|
|
9
9
|
# rack compatible body
|
|
10
10
|
#
|
|
11
|
-
# @return [
|
|
12
|
-
# rack compatible response array
|
|
11
|
+
# @return [Response::HTML]
|
|
13
12
|
#
|
|
14
13
|
# @example
|
|
15
|
-
#
|
|
14
|
+
#
|
|
16
15
|
# # With defaults
|
|
17
16
|
# response = Response::HTML.build("<html><body>Hello</body></html>")
|
|
18
17
|
# response.status # => Response::Status::OK
|
|
@@ -23,6 +22,7 @@ class Response
|
|
|
23
22
|
# response = Response::HTML.build("<html><body>Hello</body></html>") do |response|
|
|
24
23
|
# response.with_status(Respnse::Status::NOT_FOUND)
|
|
25
24
|
# end
|
|
25
|
+
#
|
|
26
26
|
# response.status # => Response::Status::NOT_FOUND
|
|
27
27
|
# response.headers # => { 'Content-Type' => 'text/html; charset=UTF-8' }
|
|
28
28
|
# response.body # => "<html><body>Hello</body></html>"
|
data/lib/response/json.rb
CHANGED
|
@@ -8,11 +8,10 @@ class Response
|
|
|
8
8
|
# @param [Object] body
|
|
9
9
|
# rack compatible body
|
|
10
10
|
#
|
|
11
|
-
# @return [
|
|
12
|
-
# rack compatible response array
|
|
11
|
+
# @return [Response::JSON]
|
|
13
12
|
#
|
|
14
13
|
# @example
|
|
15
|
-
#
|
|
14
|
+
#
|
|
16
15
|
# # With defaults
|
|
17
16
|
# response = Response::JSON.build('{"foo":"bar"}')
|
|
18
17
|
# response.status # => Response::Status::OK
|
|
@@ -20,9 +19,10 @@ class Response
|
|
|
20
19
|
# response.body # => "{\"foo\":\"bar\"}"
|
|
21
20
|
#
|
|
22
21
|
# # With overriding defaults
|
|
23
|
-
# response = Response::
|
|
22
|
+
# response = Response::JSON.build("<foo><bar>Hello</bar></foo>") do |response|
|
|
24
23
|
# response.with_status(Response::Status::NOT_FOUND)
|
|
25
24
|
# end
|
|
25
|
+
#
|
|
26
26
|
# response.status # => Response::Status::NOT_FOUND
|
|
27
27
|
# response.headers # => { 'Content-Type' => 'application/json; charset=UTF-8' }
|
|
28
28
|
# response.body # => "{\"foo\":\"bar\"}"
|
data/lib/response/redirect.rb
CHANGED
|
@@ -6,19 +6,18 @@ class Response
|
|
|
6
6
|
# Build redirect response
|
|
7
7
|
#
|
|
8
8
|
# @param [String] location
|
|
9
|
-
# the location to redirect to
|
|
9
|
+
# the location to redirect to
|
|
10
10
|
#
|
|
11
|
-
# @return [
|
|
12
|
-
# rack compatible array
|
|
11
|
+
# @return [Response::Redirect]
|
|
13
12
|
#
|
|
14
|
-
# @example
|
|
13
|
+
# @example
|
|
15
14
|
#
|
|
16
15
|
# # 302 response
|
|
17
16
|
# response = Response::Redirect::Found.build('http://example.com')
|
|
18
17
|
# response.status # => 302
|
|
19
18
|
# response.headers # => { "Location" => "http://example.com", "Content-Type" => "text/plain" }
|
|
20
19
|
# response.body # => "You are beeing redirected to: http://example.com"
|
|
21
|
-
#
|
|
20
|
+
#
|
|
22
21
|
# # 301 response
|
|
23
22
|
# response = Response::Redirect::Permanent.build('http://example.com')
|
|
24
23
|
# response.status # => 301
|
|
@@ -34,7 +33,7 @@ class Response
|
|
|
34
33
|
# response[2] # => "Redirection"
|
|
35
34
|
#
|
|
36
35
|
# @api public
|
|
37
|
-
#
|
|
36
|
+
#
|
|
38
37
|
def self.build(location)
|
|
39
38
|
super(self::STATUS, {'Location' => location, 'Content-Type' => TEXT_PLAIN}, "You are beeing redirected to: #{location}")
|
|
40
39
|
end
|
data/lib/response/text.rb
CHANGED
|
@@ -8,11 +8,10 @@ class Response
|
|
|
8
8
|
# @param [Object] body
|
|
9
9
|
# rack compatible body
|
|
10
10
|
#
|
|
11
|
-
# @return [
|
|
12
|
-
# rack compatible response array
|
|
11
|
+
# @return [Response::Text]
|
|
13
12
|
#
|
|
14
13
|
# @example
|
|
15
|
-
#
|
|
14
|
+
#
|
|
16
15
|
# # With defaults
|
|
17
16
|
# response = Response::Text.build('foo')
|
|
18
17
|
# response.status # => Response::Status::OK
|
|
@@ -20,9 +19,10 @@ class Response
|
|
|
20
19
|
# response.body # => "foo"
|
|
21
20
|
#
|
|
22
21
|
# # With overriding defaults
|
|
23
|
-
# response = Response::
|
|
22
|
+
# response = Response::Text.build('foo') do |response|
|
|
24
23
|
# response.with_status(Respnse::Status::NOT_FOUND)
|
|
25
24
|
# end
|
|
25
|
+
#
|
|
26
26
|
# response.status # => Response::Status::NOT_FOUND
|
|
27
27
|
# response.headers # => { 'Content-Type' => 'text/plain; charset=UTF-8' }
|
|
28
28
|
# response.body # => "foo"
|
|
@@ -32,6 +32,5 @@ class Response
|
|
|
32
32
|
def self.build(body)
|
|
33
33
|
super(Status::OK, HEADERS, body)
|
|
34
34
|
end
|
|
35
|
-
|
|
36
35
|
end
|
|
37
36
|
end
|
data/lib/response/xml.rb
CHANGED
|
@@ -8,11 +8,10 @@ class Response
|
|
|
8
8
|
# @param [Object] body
|
|
9
9
|
# rack compatible body
|
|
10
10
|
#
|
|
11
|
-
# @return [
|
|
12
|
-
# rack compatible response array
|
|
11
|
+
# @return [Response::XML]
|
|
13
12
|
#
|
|
14
13
|
# @example
|
|
15
|
-
#
|
|
14
|
+
#
|
|
16
15
|
# # With defaults
|
|
17
16
|
# response = Response::XML.build("<foo><bar>Hello</bar></foo>")
|
|
18
17
|
# response.status # => Response::Status::OK
|
|
@@ -20,9 +19,10 @@ class Response
|
|
|
20
19
|
# response.body # => "<foo><bar>Hello</bar></foo>"
|
|
21
20
|
#
|
|
22
21
|
# # With overriding defaults
|
|
23
|
-
# response = Response::
|
|
22
|
+
# response = Response::XML.build("<foo><bar>Hello</bar></foo>") do |response|
|
|
24
23
|
# response.with_status(Response::Status::NOT_FOUND)
|
|
25
24
|
# end
|
|
25
|
+
#
|
|
26
26
|
# response.status # => Response::Status::NOT_FOUND
|
|
27
27
|
# response.headers # => { 'Content-Type' => 'application/xml; charset=UTF-8' }
|
|
28
28
|
# response.body # => "<foo><bar>Hello</bar></foo>"
|
data/lib/response.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#encoding: utf-8
|
|
2
|
+
|
|
2
3
|
require 'time'
|
|
3
4
|
require 'ice_nine'
|
|
4
5
|
require 'adamantium'
|
|
@@ -10,7 +11,7 @@ require 'equalizer'
|
|
|
10
11
|
class Response
|
|
11
12
|
include Adamantium::Flat, Concord.new(:status, :headers, :body)
|
|
12
13
|
|
|
13
|
-
# Error raised when finalizing responses with undefined components
|
|
14
|
+
# Error raised when finalizing responses with undefined components
|
|
14
15
|
class InvalidError < RuntimeError; end
|
|
15
16
|
|
|
16
17
|
TEXT_PLAIN = 'text/plain; charset=UTF-8'.freeze
|
|
@@ -108,7 +109,7 @@ class Response
|
|
|
108
109
|
# @example
|
|
109
110
|
#
|
|
110
111
|
# response = Response.new
|
|
111
|
-
# response = response.
|
|
112
|
+
# response = response.with_headers({'Foo' => 'Bar'})
|
|
112
113
|
# response.headers # => {'Foo' => 'Bar'}
|
|
113
114
|
#
|
|
114
115
|
# @api public
|
|
@@ -125,7 +126,7 @@ class Response
|
|
|
125
126
|
# @example
|
|
126
127
|
#
|
|
127
128
|
# response = Response.new(200, {'Foo' => 'Baz', 'John' => 'Doe'})
|
|
128
|
-
# response = response.
|
|
129
|
+
# response = response.merge_headers({'Foo' => 'Bar'})
|
|
129
130
|
# response.headers # => {'Foo' => 'Bar', 'John' => 'Doe'}
|
|
130
131
|
#
|
|
131
132
|
# @api public
|
|
@@ -139,8 +140,8 @@ class Response
|
|
|
139
140
|
|
|
140
141
|
# Return rack compatible array after asserting response is valid
|
|
141
142
|
#
|
|
142
|
-
# @return [Array]
|
|
143
|
-
# rack compatible array
|
|
143
|
+
# @return [Array(Fixnum, Enumerable(Hash{String => String}), Enumerable<String>)]
|
|
144
|
+
# a rack compatible array
|
|
144
145
|
#
|
|
145
146
|
# @raise InvalidError
|
|
146
147
|
# raises InvalidError when request containts undefined components
|
|
@@ -169,7 +170,7 @@ class Response
|
|
|
169
170
|
|
|
170
171
|
# Return rack compatible array
|
|
171
172
|
#
|
|
172
|
-
# @return [Array]
|
|
173
|
+
# @return [Array(Fixnum, Enumerable(Hash{String => String}), Enumerable<String>)]
|
|
173
174
|
# rack compatible array
|
|
174
175
|
#
|
|
175
176
|
# @example
|
|
@@ -194,10 +195,14 @@ class Response
|
|
|
194
195
|
headers['Content-Type']
|
|
195
196
|
end
|
|
196
197
|
|
|
197
|
-
# Return last modified
|
|
198
|
+
# Return last modified
|
|
198
199
|
#
|
|
199
|
-
# @
|
|
200
|
-
# if
|
|
200
|
+
# @raise [ArgumentError]
|
|
201
|
+
# if content of Last-Modified header is not a RFC 2616 compliant date
|
|
202
|
+
#
|
|
203
|
+
# @return [String]
|
|
204
|
+
# if last modified header is present, a string which represents the time
|
|
205
|
+
# as rfc1123-date of HTTP-date defined by RFC 2616
|
|
201
206
|
#
|
|
202
207
|
# @return [nil]
|
|
203
208
|
# otherwise
|
|
@@ -234,8 +239,7 @@ class Response
|
|
|
234
239
|
# response.headers # => {'Foo' => 'Bar' }
|
|
235
240
|
# response.body # => 'Hello'
|
|
236
241
|
#
|
|
237
|
-
# @return [
|
|
238
|
-
# rack compatible array
|
|
242
|
+
# @return [Response]
|
|
239
243
|
#
|
|
240
244
|
# @api public
|
|
241
245
|
#
|
|
@@ -247,10 +251,10 @@ class Response
|
|
|
247
251
|
|
|
248
252
|
private
|
|
249
253
|
|
|
250
|
-
# Raise error when request
|
|
254
|
+
# Raise error when request contains undefined components
|
|
251
255
|
#
|
|
252
256
|
# @raise InvalidError
|
|
253
|
-
# raises InvalidError when request
|
|
257
|
+
# raises InvalidError when request contains undefined components
|
|
254
258
|
#
|
|
255
259
|
# @return [undefined]
|
|
256
260
|
#
|
|
@@ -258,7 +262,7 @@ private
|
|
|
258
262
|
#
|
|
259
263
|
def assert_valid
|
|
260
264
|
unless valid?
|
|
261
|
-
raise InvalidError, "Not a valid response: #{
|
|
265
|
+
raise InvalidError, "Not a valid response: #{inspect}"
|
|
262
266
|
end
|
|
263
267
|
end
|
|
264
268
|
end
|
data/response.gemspec
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |gem|
|
|
4
4
|
gem.name = 'response'
|
|
5
|
-
gem.version = '0.0.
|
|
5
|
+
gem.version = '0.0.4'
|
|
6
6
|
gem.authors = [ 'Markus Schirp' ]
|
|
7
7
|
gem.email = [ 'mbj@schir-dso.com' ]
|
|
8
8
|
gem.description = 'Build rack responses with functional style'
|
|
@@ -14,9 +14,9 @@ Gem::Specification.new do |gem|
|
|
|
14
14
|
gem.test_files = `git ls-files -- {spec}/*`.split("\n")
|
|
15
15
|
gem.extra_rdoc_files = %w[LICENSE README.md TODO]
|
|
16
16
|
|
|
17
|
-
gem.add_dependency('ice_nine', '~> 0.
|
|
18
|
-
gem.add_dependency('adamantium', '~> 0.0
|
|
19
|
-
gem.add_dependency('equalizer', '~> 0.0.
|
|
20
|
-
gem.add_dependency('abstract_type', '~> 0.0.
|
|
21
|
-
gem.add_dependency('concord', '~> 0.1.
|
|
17
|
+
gem.add_dependency('ice_nine', '~> 0.9.0')
|
|
18
|
+
gem.add_dependency('adamantium', '~> 0.1.0')
|
|
19
|
+
gem.add_dependency('equalizer', '~> 0.0.7')
|
|
20
|
+
gem.add_dependency('abstract_type', '~> 0.0.6')
|
|
21
|
+
gem.add_dependency('concord', '~> 0.1.4')
|
|
22
22
|
end
|
|
@@ -16,7 +16,7 @@ describe Response, '.build' do
|
|
|
16
16
|
|
|
17
17
|
context 'with block' do
|
|
18
18
|
let(:yields) { [] }
|
|
19
|
-
let(:value) {
|
|
19
|
+
let(:value) { double('Value') }
|
|
20
20
|
let(:block) { lambda { |response| yields << response; value } }
|
|
21
21
|
|
|
22
22
|
it 'should return value from block' do
|
|
@@ -3,9 +3,9 @@ require 'spec_helper'
|
|
|
3
3
|
describe Response::JSON, '.build' do
|
|
4
4
|
subject { object.build(body) }
|
|
5
5
|
|
|
6
|
-
let(:body) {
|
|
6
|
+
let(:body) { double('Body') }
|
|
7
7
|
let(:object) { described_class }
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
its(:status) { should be(Response::Status::OK) }
|
|
10
10
|
its(:body) { should be(body) }
|
|
11
11
|
its(:headers) { should eql('Content-Type' => 'application/json; charset=UTF-8') }
|
|
@@ -8,8 +8,8 @@ describe Response, '#merge_headers' do
|
|
|
8
8
|
let(:update_headers) { { 'Baz' => 'Zot' } }
|
|
9
9
|
let(:original_headers) { { 'Foo' => 'Bar' } }
|
|
10
10
|
|
|
11
|
-
let(:status) {
|
|
12
|
-
let(:body) {
|
|
11
|
+
let(:status) { double('Status') }
|
|
12
|
+
let(:body) { double('Body') }
|
|
13
13
|
|
|
14
14
|
its(:status) { should be(status) }
|
|
15
15
|
its(:body) { should be(body) }
|
|
@@ -4,8 +4,8 @@ describe Response, '#rack_array' do
|
|
|
4
4
|
subject { object.rack_array }
|
|
5
5
|
|
|
6
6
|
let(:status) { Response::Status::OK }
|
|
7
|
-
let(:headers) {
|
|
8
|
-
let(:body) {
|
|
7
|
+
let(:headers) { double('Headers') }
|
|
8
|
+
let(:body) { double('Body') }
|
|
9
9
|
|
|
10
10
|
let(:object) { described_class.build(status, headers, body) }
|
|
11
11
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Response::Redirect::Found, '#build' do
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
subject { object.build(location) }
|
|
6
6
|
|
|
7
7
|
let(:object) { described_class }
|
|
8
8
|
|
|
9
|
-
let(:location) {
|
|
9
|
+
let(:location) { double('Location', :to_s => 'THE-LOCATION') }
|
|
10
10
|
|
|
11
11
|
its(:status) { should be(Response::Status::FOUND) }
|
|
12
12
|
its(:headers) { should eql('Location' => location, 'Content-Type' => 'text/plain; charset=UTF-8') }
|
|
@@ -14,12 +14,12 @@ describe Response::Redirect::Found, '#build' do
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
describe Response::Redirect::Permanent, '#build' do
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
subject { object.build(location) }
|
|
19
19
|
|
|
20
20
|
let(:object) { described_class }
|
|
21
21
|
|
|
22
|
-
let(:location) {
|
|
22
|
+
let(:location) { double('Location', :to_s => 'THE-LOCATION') }
|
|
23
23
|
|
|
24
24
|
its(:status) { should be(Response::Status::MOVED_PERMANENTLY) }
|
|
25
25
|
its(:headers) { should eql('Location' => location, 'Content-Type' => 'text/plain; charset=UTF-8') }
|
|
@@ -5,8 +5,8 @@ describe Response, '#to_rack_response' do
|
|
|
5
5
|
subject { object.to_rack_response }
|
|
6
6
|
|
|
7
7
|
let(:status) { Response::Status::OK }
|
|
8
|
-
let(:headers) {
|
|
9
|
-
let(:body) {
|
|
8
|
+
let(:headers) { double('Headers') }
|
|
9
|
+
let(:body) { double('Body') }
|
|
10
10
|
|
|
11
11
|
context 'with valid response' do
|
|
12
12
|
let(:object) { Response.build(status, headers, body) }
|
|
@@ -4,7 +4,7 @@ describe Response, '#valid?' do
|
|
|
4
4
|
subject { object.valid? }
|
|
5
5
|
|
|
6
6
|
context 'with status and body' do
|
|
7
|
-
let(:object) { described_class.build(Response::Status::OK, {},
|
|
7
|
+
let(:object) { described_class.build(Response::Status::OK, {}, double('Body')) }
|
|
8
8
|
|
|
9
9
|
it { should be(true) }
|
|
10
10
|
|
|
@@ -20,7 +20,7 @@ describe Response, '#valid?' do
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
context 'without status' do
|
|
23
|
-
let(:object) { described_class.build.with_body(
|
|
23
|
+
let(:object) { described_class.build.with_body(double('Body')) }
|
|
24
24
|
|
|
25
25
|
it { should be(false) }
|
|
26
26
|
|
|
@@ -6,9 +6,9 @@ describe Response, '#with_body' do
|
|
|
6
6
|
let(:object) { described_class.build }
|
|
7
7
|
|
|
8
8
|
let(:status) { Response::Status::OK }
|
|
9
|
-
let(:body) {
|
|
10
|
-
let(:headers) {
|
|
11
|
-
|
|
9
|
+
let(:body) { double('Body') }
|
|
10
|
+
let(:headers) { double('Headers') }
|
|
11
|
+
|
|
12
12
|
its(:status) { should be(status) }
|
|
13
13
|
its(:body) { should be(body) }
|
|
14
14
|
its(:headers) { should be(headers) }
|
|
@@ -6,9 +6,9 @@ describe Response, '#with_headers' do
|
|
|
6
6
|
let(:object) { described_class.build }
|
|
7
7
|
|
|
8
8
|
let(:status) { Response::Status::OK }
|
|
9
|
-
let(:body) {
|
|
10
|
-
let(:headers) {
|
|
11
|
-
|
|
9
|
+
let(:body) { double('Body') }
|
|
10
|
+
let(:headers) { double('Headers') }
|
|
11
|
+
|
|
12
12
|
its(:status) { should be(status) }
|
|
13
13
|
its(:body) { should be(body) }
|
|
14
14
|
its(:headers) { should be(headers) }
|
|
@@ -5,10 +5,10 @@ describe Response, '#with_status' do
|
|
|
5
5
|
|
|
6
6
|
let(:object) { described_class.build }
|
|
7
7
|
let(:status) { Response::Status::OK }
|
|
8
|
-
|
|
9
|
-
let(:body) {
|
|
10
|
-
let(:headers) {
|
|
11
|
-
|
|
8
|
+
|
|
9
|
+
let(:body) { double('Body') }
|
|
10
|
+
let(:headers) { double('Headers') }
|
|
11
|
+
|
|
12
12
|
its(:status) { should be(status) }
|
|
13
13
|
its(:body) { should be(body) }
|
|
14
14
|
its(:headers) { should be(headers) }
|
|
@@ -3,9 +3,9 @@ require 'spec_helper'
|
|
|
3
3
|
describe Response::XML, '.build' do
|
|
4
4
|
subject { object.build(body) }
|
|
5
5
|
|
|
6
|
-
let(:body) {
|
|
6
|
+
let(:body) { double('Body') }
|
|
7
7
|
let(:object) { described_class }
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
its(:status) { should be(Response::Status::OK) }
|
|
10
10
|
its(:body) { should be(body) }
|
|
11
11
|
its(:headers) { should eql('Content-Type' => 'application/xml; charset=UTF-8') }
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: response
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Markus Schirp
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-
|
|
11
|
+
date: 2013-09-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ice_nine
|
|
@@ -16,70 +16,70 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ~>
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.
|
|
19
|
+
version: 0.9.0
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ~>
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.
|
|
26
|
+
version: 0.9.0
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: adamantium
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - ~>
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 0.0
|
|
33
|
+
version: 0.1.0
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - ~>
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 0.0
|
|
40
|
+
version: 0.1.0
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: equalizer
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
45
|
- - ~>
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 0.0.
|
|
47
|
+
version: 0.0.7
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - ~>
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 0.0.
|
|
54
|
+
version: 0.0.7
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: abstract_type
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
59
|
- - ~>
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: 0.0.
|
|
61
|
+
version: 0.0.6
|
|
62
62
|
type: :runtime
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
66
|
- - ~>
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: 0.0.
|
|
68
|
+
version: 0.0.6
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: concord
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
73
|
- - ~>
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: 0.1.
|
|
75
|
+
version: 0.1.4
|
|
76
76
|
type: :runtime
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - ~>
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: 0.1.
|
|
82
|
+
version: 0.1.4
|
|
83
83
|
description: Build rack responses with functional style
|
|
84
84
|
email:
|
|
85
85
|
- mbj@schir-dso.com
|