syntropy 0.27 → 0.27.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b84251781cfce3688f58c6f25a754b0699d97fe4a7c51f390b63635b45007960
4
- data.tar.gz: 69e85137dcee6b399d3198303f9de4227b5276521a6c964eca5ac4954a9fb10f
3
+ metadata.gz: 8fd5a77712915e9472ed58a8786dce7369e9d24852533c19ce25d9f4959815bf
4
+ data.tar.gz: d6420486dc63bb1227b723f14e28e170e6e772f28970a2ce62e2d8283bdcd2b8
5
5
  SHA512:
6
- metadata.gz: dd871276c35cd2a9c216f37ec1361794e34f489af71580a1da5cebef244830daf0e2bc4e418abe28623607e8da5693ead8074dd1f397ba9ea61afb0e4bcf7d96
7
- data.tar.gz: 2b3ae1c3c4691d247357a8ec3d9f7e3da778c0fcdd7a94de84b2d83c94ffe75c7beb7ec7883976c2ca09b5c45225391b9322e28a32be9cc3a55acfc6d8c5ac9e
6
+ metadata.gz: 5041a3820ed58393b643c7ed298fbdfedf255b9116156a1909d39bf0dfbb842004b38a651c85419d28c5dc2cae9b1c0d5fb13a9e24bbb1ec5340508ffbe7591c
7
+ data.tar.gz: d239554ae9e5b8c1b3159cbc0bb13cc828d2b00a4cf376197aaeb7740c57ae49d6419ccb957893bc6a1026d2db273a77f25a2960e6c21d84dad68528bf2ebf97
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.27.1 2025-10-21
2
+
3
+ - Fix error instantiation and error testing
4
+
1
5
  # 0.27 2025-10-21
2
6
 
3
7
  - Use accept header (instead of user-agent) for rendering error page
@@ -56,7 +56,7 @@ module Syntropy
56
56
  # ValidationError is raised when a validation has failed.
57
57
  class ValidationError < Error
58
58
  def initialize(msg)
59
- super(Qeweney::Status::BAD_REQUEST, msg)
59
+ super(msg, Qeweney::Status::BAD_REQUEST)
60
60
  end
61
61
  end
62
62
  end
@@ -177,12 +177,12 @@ module Syntropy
177
177
  def get_form_data
178
178
  body = read
179
179
  if !body || body.empty?
180
- raise Syntropy::Error.new(Qeweney::Status::BAD_REQUEST, 'Missing form data')
180
+ raise Syntropy::Error.new('Missing form data', Qeweney::Status::BAD_REQUEST)
181
181
  end
182
182
 
183
183
  Qeweney::Request.parse_form_data(body, headers)
184
184
  rescue Qeweney::BadRequestError
185
- raise Syntropy::Error.new(Qeweney::Status::BAD_REQUEST, 'Invalid form data')
185
+ raise Syntropy::Error.new('Invalid form data', Qeweney::Status::BAD_REQUEST)
186
186
  end
187
187
 
188
188
  def html_response(html, **headers)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Syntropy
4
- VERSION = '0.27'
4
+ VERSION = '0.27.1'
5
5
  end
data/test/app/api+.rb CHANGED
@@ -10,7 +10,7 @@ class API < Syntropy::JSONAPI
10
10
 
11
11
  def incr!(req)
12
12
  if req.path != '/test/api'
13
- raise Syntropy::Error.new(Qeweney::Status::TEAPOT, 'Teapot')
13
+ raise Syntropy::Error.new('Teapot', Qeweney::Status::TEAPOT)
14
14
  end
15
15
 
16
16
  @count += 1
data/test/test_app.rb CHANGED
@@ -50,7 +50,7 @@ class AppTest < Minitest::Test
50
50
 
51
51
  req = make_request(':method' => 'POST', ':path' => '/test')
52
52
  assert_equal Status::METHOD_NOT_ALLOWED, req.response_status
53
- assert_nil req.response_body
53
+ assert_equal "Method not allowed", req.response_body
54
54
 
55
55
  req = make_request(':method' => 'GET', ':path' => '/test/assets/style.css')
56
56
  assert_equal '* { color: beige }', req.response_body
@@ -64,7 +64,7 @@ class AppTest < Minitest::Test
64
64
 
65
65
  req = make_request(':method' => 'POST', ':path' => '/test/api?q=get')
66
66
  assert_equal Status::METHOD_NOT_ALLOWED, req.response_status
67
- assert_equal({ status: 'Error', message: '' }, req.response_json)
67
+ assert_equal({ status: 'Error', message: 'Method not allowed' }, req.response_json)
68
68
 
69
69
  req = make_request(':method' => 'GET', ':path' => '/test/api/foo?q=get')
70
70
  assert_equal({ status: 'OK', response: 0 }, req.response_json)
@@ -74,7 +74,7 @@ class AppTest < Minitest::Test
74
74
 
75
75
  req = make_request(':method' => 'GET', ':path' => '/test/api?q=incr')
76
76
  assert_equal Status::METHOD_NOT_ALLOWED, req.response_status
77
- assert_equal({ status: 'Error', message: '' }, req.response_json)
77
+ assert_equal({ status: 'Error', message: 'Method not allowed' }, req.response_json)
78
78
 
79
79
  req = make_request(':method' => 'POST', ':path' => '/test/api/foo?q=incr')
80
80
  assert_equal({ status: 'Error', message: 'Teapot' }, req.response_json)
@@ -97,7 +97,7 @@ class AppTest < Minitest::Test
97
97
  assert_equal Status::OK, req.response_status
98
98
 
99
99
  req = make_request(':method' => 'POST', ':path' => '/test/baz')
100
- assert_nil req.response_body
100
+ assert_equal 'Method not allowed', req.response_body
101
101
  assert_equal Status::METHOD_NOT_ALLOWED, req.response_status
102
102
 
103
103
  req = make_request(':method' => 'GET', ':path' => '/test/about')
data/test/test_errors.rb CHANGED
@@ -12,7 +12,7 @@ class ErrorsTest < Minitest::Test
12
12
  e = Syntropy::Error.new
13
13
  assert_equal ISE, Syntropy::Error.http_status(e)
14
14
 
15
- e = Syntropy::Error.new(Qeweney::Status::UNAUTHORIZED)
15
+ e = Syntropy::Error.new("", Qeweney::Status::UNAUTHORIZED)
16
16
  assert_equal Qeweney::Status::UNAUTHORIZED, Syntropy::Error.http_status(e)
17
17
  end
18
18
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syntropy
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.27'
4
+ version: 0.27.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sharon Rosner