deas-json 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA512:
3
- data.tar.gz: 9265f376858f12180456774dc1fff459b70ad3a2ce7753cf6d383496fd0a2d7b7b31dde0218a593e7d53373e1ada634e657a1643389027916bd42d54499efe58
4
- metadata.gz: 4751662c8463f50e7286f182780165e98ca306c57c5e00dc731e85ed5f9e476d8037454a73993d5667effd522543a24136f0fcd32eee4cdbcd84f523014d63b7
3
+ metadata.gz: ffb78b97d32a51e70c814c6d4ba88679de271f00e93b013284119e3012332748ffc1375d6c9f5b7a6dee8c787ba1ed8e4b3f2b70d63a6f95b631c83d8e81e736
4
+ data.tar.gz: 697337237b5f8a0df6af90d68f9b2165289b3ae86557bf082b03255009e3258d88c7836ba5bd250ae9f224344bea322d3373fe7e1fe81569fa9bb26329454041
5
5
  SHA1:
6
- data.tar.gz: ee54c1570e36d7be5bc7ee736b26d50ddbb8a78f
7
- metadata.gz: abd74483336fdc8106055fd6fe4946a27322dc59
6
+ metadata.gz: b86dfc65f0df9f644eca7b0cb7aa489922aec73e
7
+ data.tar.gz: 6e80493cd90b61b8e4b7c733e66cfdc3d5d6ca54
data/Gemfile CHANGED
@@ -2,4 +2,5 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'pry', "~> 0.9.0"
5
+ gem 'pry', "~> 0.9.0"
6
+ gem 'rack', " = 1.6.8"
data/deas-json.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
20
20
 
21
21
  gem.add_development_dependency("assert", ["~> 2.16.3"])
22
22
 
23
- gem.add_dependency("deas", ["~> 0.43.0"])
23
+ gem.add_dependency("deas", ["~> 0.43.4"])
24
24
  gem.add_dependency("much-plugin", ["~> 0.2.0"])
25
25
 
26
26
  end
@@ -1,4 +1,4 @@
1
1
  module Deas; end
2
2
  module Deas::Json
3
- VERSION = "0.3.3"
3
+ VERSION = "0.3.4"
4
4
  end
@@ -23,12 +23,13 @@ module Deas::Json
23
23
 
24
24
  # Some http clients will error when trying to parse an empty body when the
25
25
  # content type is 'json'. This will default the body to a string that
26
- # can be parsed to an empty json object
26
+ # can be parsed to an empty json object.
27
+ # We call the `body` helper method to make sure it adhere's to the Rack spec
27
28
  def halt(*args)
28
29
  super(
29
30
  args.first.instance_of?(::Fixnum) ? args.shift : DEF_STATUS,
30
31
  args.first.kind_of?(::Hash) ? args.shift : DEF_HEADERS,
31
- args.first.respond_to?(:each) ? args.shift : DEF_BODY
32
+ body(!args.first.to_s.empty? ? args.shift : DEF_BODY)
32
33
  )
33
34
  end
34
35
 
@@ -57,12 +57,21 @@ module Deas::Json::ViewHandler
57
57
  assert_equal @body, response.body
58
58
  end
59
59
 
60
+ should "should adhere to the rack spec for its body" do
61
+ @handler.halt_args = [@status, @headers, @body.first]
62
+ response = @runner.run
63
+
64
+ assert_equal @status, response.status
65
+ assert_equal @headers, response.headers
66
+ assert_equal @body, response.body
67
+ end
68
+
60
69
  should "default its status, headers and body if not provided" do
61
70
  response = @runner.run
62
71
 
63
72
  assert_equal DEF_STATUS, response.status
64
73
  assert_equal DEF_HEADERS, response.headers
65
- assert_equal DEF_BODY, response.body
74
+ assert_equal [DEF_BODY], response.body
66
75
  end
67
76
 
68
77
  should "default its headers and body if not provided" do
@@ -71,7 +80,7 @@ module Deas::Json::ViewHandler
71
80
 
72
81
  assert_equal @status, response.status
73
82
  assert_equal DEF_HEADERS, response.headers
74
- assert_equal DEF_BODY, response.body
83
+ assert_equal [DEF_BODY], response.body
75
84
  end
76
85
 
77
86
  should "default its status and body if not provided" do
@@ -80,7 +89,7 @@ module Deas::Json::ViewHandler
80
89
 
81
90
  assert_equal DEF_STATUS, response.status
82
91
  assert_equal @headers, response.headers
83
- assert_equal DEF_BODY, response.body
92
+ assert_equal [DEF_BODY], response.body
84
93
  end
85
94
 
86
95
  should "default its status and headers if not provided" do
@@ -111,12 +120,12 @@ module Deas::Json::ViewHandler
111
120
  end
112
121
 
113
122
  should "default its body if not provided" do
114
- @handler.halt_args = [@status, @headers]
123
+ @handler.halt_args = [@status, @headers, [nil, ''].sample]
115
124
  response = @runner.run
116
125
 
117
- assert_equal @status, response.status
118
- assert_equal @headers, response.headers
119
- assert_equal DEF_BODY, response.body
126
+ assert_equal @status, response.status
127
+ assert_equal @headers, response.headers
128
+ assert_equal [DEF_BODY], response.body
120
129
  end
121
130
 
122
131
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deas-json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Redding
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2016-09-14 00:00:00 Z
13
+ date: 2018-04-18 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: assert
@@ -29,7 +29,7 @@ dependencies:
29
29
  requirements:
30
30
  - - ~>
31
31
  - !ruby/object:Gem::Version
32
- version: 0.43.0
32
+ version: 0.43.4
33
33
  type: :runtime
34
34
  version_requirements: *id002
35
35
  - !ruby/object:Gem::Dependency
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  requirements: []
89
89
 
90
90
  rubyforge_project:
91
- rubygems_version: 2.6.4
91
+ rubygems_version: 2.6.6
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: JSON helpers for Deas apps