rock_rms 9.5.0 → 9.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rock_rms/error.rb +7 -1
- data/lib/rock_rms/version.rb +1 -1
- data/spec/rock_rms/error_spec.rb +6 -0
- data/spec/rock_rms/fixtures/document_moved.html +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adc5ecace53e1ff1edbc454de1f30260228803924cfdc8016f022bc7fae915dd
|
4
|
+
data.tar.gz: f166b2bbff5250b3855d11db886a566723757a3b306a8b48373dbeb83a2f9710
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3f0f9fec4849a2034de7196b22e598ab13430f04bf2259a98d7cc332363559432ecab5cc0441edf363f750609357671097affe4062e71b6fe2df8f19e170539
|
7
|
+
data.tar.gz: e8a04bff612b38eb2b85c9e5f6584ff619270e4bac4b496e9402cf28db1d39e1ded0ff644c29f9dd39702ed208a2f36bfe12e39bf10bb9b7791ad6a184933d13
|
data/lib/rock_rms/error.rb
CHANGED
@@ -46,7 +46,7 @@ module FaradayMiddleware
|
|
46
46
|
private
|
47
47
|
|
48
48
|
def html_body?(body)
|
49
|
-
/(<!DOCTYPE html>)|(<html>)/ =~ body
|
49
|
+
/(<!DOCTYPE html>)|(<html>)|(<head>)/ =~ body
|
50
50
|
end
|
51
51
|
|
52
52
|
def check_html_error(env)
|
@@ -63,6 +63,12 @@ module FaradayMiddleware
|
|
63
63
|
status: 404, url: env[:url], body: 'Page not found.'
|
64
64
|
)
|
65
65
|
end
|
66
|
+
|
67
|
+
if /Document Moved/ =~ env[:body]
|
68
|
+
raise RockRMS::NotFound, error_message(
|
69
|
+
status: 404, url: env[:url], body: 'Object Moved'
|
70
|
+
)
|
71
|
+
end
|
66
72
|
end
|
67
73
|
|
68
74
|
def error_message(env)
|
data/lib/rock_rms/version.rb
CHANGED
data/spec/rock_rms/error_spec.rb
CHANGED
@@ -86,5 +86,11 @@ RSpec.describe RockRMS::Error do
|
|
86
86
|
stub(200, body)
|
87
87
|
expect_failure(404, 'Page not found.')
|
88
88
|
end
|
89
|
+
|
90
|
+
it 'raises exception for not found error' do
|
91
|
+
body = File.read('spec/rock_rms/fixtures/document_moved.html')
|
92
|
+
stub(200, body)
|
93
|
+
expect_failure(404, 'Object Moved')
|
94
|
+
end
|
89
95
|
end
|
90
96
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rock_rms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.
|
4
|
+
version: 9.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taylor Brooks
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -265,6 +265,7 @@ files:
|
|
265
265
|
- rock_rms.gemspec
|
266
266
|
- spec/rock_rms/client_spec.rb
|
267
267
|
- spec/rock_rms/error_spec.rb
|
268
|
+
- spec/rock_rms/fixtures/document_moved.html
|
268
269
|
- spec/rock_rms/fixtures/internal_error.html
|
269
270
|
- spec/rock_rms/fixtures/not_found_error.html
|
270
271
|
- spec/rock_rms/resources/attribute_spec.rb
|