Skip to content

Commit efaa23d

Browse files
committed
Add a quick test for config and text errors.
1 parent f4e61b6 commit efaa23d

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

test/controllers/controller_test.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ def set_content_type_header!
44
@request.headers['Content-Type'] = JSONAPI::MEDIA_TYPE
55
end
66

7+
class ConfigControllerTest < ActionController::TestCase
8+
9+
end
10+
711
class PostsControllerTest < ActionController::TestCase
812
def test_index
913
get :index
@@ -1388,6 +1392,14 @@ def setup
13881392
JSONAPI.configuration.json_key_format = :camelized_key
13891393
end
13901394

1395+
def test_text_error
1396+
JSONAPI.configuration.use_text_errors = true
1397+
get :index, {sort: 'not_in_record'}
1398+
assert_response 400
1399+
assert_equal 'INVALID_SORT_FORMAT', json_response['errors'][0]['code']
1400+
JSONAPI.configuration.use_text_errors = false
1401+
end
1402+
13911403
def test_expense_entries_index
13921404
get :index
13931405
assert_response :success

0 commit comments

Comments
 (0)