Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions test/controllers/controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ def test_show_does_not_include_records_count_in_meta
JSONAPI.configuration.top_level_meta_include_record_count = true
assert_cacheable_get :show, params: { id: Post.first.id }
assert_response :success
assert_equal json_response['meta'], nil
assert_nil json_response['meta']
ensure
JSONAPI.configuration.top_level_meta_include_record_count = false
end
Expand All @@ -492,7 +492,7 @@ def test_show_does_not_include_pages_count_in_meta
JSONAPI.configuration.top_level_meta_include_page_count = true
assert_cacheable_get :show, params: { id: Post.first.id }
assert_response :success
assert_equal json_response['meta'], nil
assert_nil json_response['meta']
ensure
JSONAPI.configuration.top_level_meta_include_page_count = false
end
Expand Down Expand Up @@ -596,7 +596,7 @@ def test_create_simple_id_not_allowed

assert_response :bad_request
assert_match /id is not allowed/, response.body
assert_equal nil,response.location
assert_nil response.location
end

def test_create_link_to_missing_object
Expand All @@ -618,7 +618,7 @@ def test_create_link_to_missing_object
assert_response :unprocessable_entity
# TODO: check if this validation is working
assert_match /author - can't be blank/, response.body
assert_equal nil, response.location
assert_nil response.location
end

def test_create_extra_param
Expand All @@ -640,7 +640,7 @@ def test_create_extra_param

assert_response :bad_request
assert_match /asdfg is not allowed/, response.body
assert_equal nil,response.location
assert_nil response.location
end

def test_create_extra_param_allow_extra_params
Expand Down Expand Up @@ -707,7 +707,7 @@ def test_create_with_invalid_data
assert_equal "/data/attributes/title", json_response['errors'][1]['source']['pointer']
assert_equal "is too long (maximum is 35 characters)", json_response['errors'][1]['title']
assert_equal "title - is too long (maximum is 35 characters)", json_response['errors'][1]['detail']
assert_equal nil, response.location
assert_nil response.location
end

def test_create_multiple
Expand Down Expand Up @@ -760,7 +760,7 @@ def test_create_simple_missing_posts

assert_response :bad_request
assert_match /The required parameter, data, is missing./, json_response['errors'][0]['detail']
assert_equal nil, response.location
assert_nil response.location
end

def test_create_simple_wrong_type
Expand All @@ -781,7 +781,7 @@ def test_create_simple_wrong_type

assert_response :bad_request
assert_match /posts_spelled_wrong is not a valid resource./, json_response['errors'][0]['detail']
assert_equal nil, response.location
assert_nil response.location
end

def test_create_simple_missing_type
Expand All @@ -801,7 +801,7 @@ def test_create_simple_missing_type

assert_response :bad_request
assert_match /The required parameter, type, is missing./, json_response['errors'][0]['detail']
assert_equal nil, response.location
assert_nil response.location
end

def test_create_simple_unpermitted_attributes
Expand All @@ -822,7 +822,7 @@ def test_create_simple_unpermitted_attributes

assert_response :bad_request
assert_match /subject/, json_response['errors'][0]['detail']
assert_equal nil, response.location
assert_nil response.location
end

def test_create_simple_unpermitted_attributes_allow_extra_params
Expand Down Expand Up @@ -1086,7 +1086,7 @@ def test_update_remove_links
assert_response :success
assert json_response['data'].is_a?(Hash)
assert_equal '3', json_response['data']['relationships']['author']['data']['id']
assert_equal nil, json_response['data']['relationships']['section']['data']
assert_nil json_response['data']['relationships']['section']['data']
assert_equal 'A great new Post', json_response['data']['attributes']['title']
assert_equal 'AAAA', json_response['data']['attributes']['body']
assert matches_array?([],
Expand Down Expand Up @@ -1116,7 +1116,7 @@ def test_update_relationship_to_one_nil

assert_response :no_content
post_object = Post.find(4)
assert_equal nil, post_object.section_id
assert_nil post_object.section_id
end

def test_update_relationship_to_one_invalid_links_hash_keys_ids
Expand Down Expand Up @@ -1233,7 +1233,7 @@ def test_update_relationship_to_one_singular_param_id_nil
put :update_relationship, params: {post_id: 3, relationship: 'section', data: {type: 'sections', id: nil}}

assert_response :no_content
assert_equal nil, post_object.reload.section_id
assert_nil post_object.reload.section_id
end

def test_update_relationship_to_one_data_nil
Expand All @@ -1246,7 +1246,7 @@ def test_update_relationship_to_one_data_nil
put :update_relationship, params: {post_id: 3, relationship: 'section', data: nil}

assert_response :no_content
assert_equal nil, post_object.reload.section_id
assert_nil post_object.reload.section_id
end

def test_remove_relationship_to_one
Expand All @@ -1260,7 +1260,7 @@ def test_remove_relationship_to_one

assert_response :no_content
post_object = Post.find(3)
assert_equal nil, post_object.section_id
assert_nil post_object.section_id
end

def test_update_relationship_to_one_singular_param
Expand Down Expand Up @@ -2585,7 +2585,7 @@ def test_get_person_as_author
assert_equal '1', json_response['data'][0]['id']
assert_equal 'authors', json_response['data'][0]['type']
assert_equal 'Joe Author', json_response['data'][0]['attributes']['name']
assert_equal nil, json_response['data'][0]['attributes']['email']
assert_nil json_response['data'][0]['attributes']['email']
end

def test_show_person_as_author
Expand All @@ -2594,7 +2594,7 @@ def test_show_person_as_author
assert_equal '1', json_response['data']['id']
assert_equal 'authors', json_response['data']['type']
assert_equal 'Joe Author', json_response['data']['attributes']['name']
assert_equal nil, json_response['data']['attributes']['email']
assert_nil json_response['data']['attributes']['email']
end

def test_get_person_as_author_by_name_filter
Expand Down
2 changes: 1 addition & 1 deletion test/unit/operation/operation_dispatcher_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def test_replace_to_one_relationship

op.process(operations)
saturn.reload
assert_equal(saturn.planet_type_id, nil)
assert_nil saturn.planet_type_id

# Reset
operations = [
Expand Down
3 changes: 1 addition & 2 deletions test/unit/serializer/link_builder_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ def test_engine_name
primary_resource_klass: ApiV2Engine::PersonResource
).engine_name

assert_equal nil,
JSONAPI::LinkBuilder.new(
assert_nil JSONAPI::LinkBuilder.new(
primary_resource_klass: Api::V1::PersonResource
).engine_name
end
Expand Down