File tree 2 files changed +17
-0
lines changed
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 3
3
4
4
class HelpScout
5
5
class ValidationError < StandardError ; end
6
+ class NotImplementedError < StandardError ; end
6
7
7
8
HTTP_CREATED = 201
8
9
HTTP_BAD_REQUEST = 400
@@ -30,6 +31,8 @@ def create_conversation(data)
30
31
elsif last_response . code == HTTP_BAD_REQUEST
31
32
# Validation failed so return the errors
32
33
raise ValidationError , last_response . parsed_response [ "message" ]
34
+ else
35
+ raise NotImplementedError , "Help Scout returned something that is not implemented by the help_scout gem yet. Sorry."
33
36
end
34
37
end
35
38
Original file line number Diff line number Diff line change 36
36
expect { client . create_conversation ( data ) } . to raise_error ( HelpScout ::ValidationError , "Email is not valid" )
37
37
end
38
38
end
39
+
40
+ context 'with a not implemented status code' do
41
+ it 'returns a not implemented error' do
42
+ data = { subject : "Help me!" }
43
+
44
+ url = 'https://api.helpscout.net/v1/conversations.json'
45
+ stub_request ( :post , url ) .
46
+ to_return (
47
+ status : 500 ,
48
+ )
49
+
50
+ expect { client . create_conversation ( data ) } . to raise_error ( HelpScout ::NotImplementedError )
51
+ end
52
+ end
39
53
end
40
54
41
55
describe '#search_conversations' do
You can’t perform that action at this time.
0 commit comments