mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-24 23:06:50 +00:00
Test::Schema exceptions should be Minitest::Assertions
This commit is contained in:
parent
070d58eacf
commit
d0d7af470c
@ -14,8 +14,8 @@ module ActiveModelSerializers
|
|||||||
assert(matcher.call, matcher.message)
|
assert(matcher.call, matcher.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
MissingSchema = Class.new(Errno::ENOENT)
|
MissingSchema = Class.new(Minitest::Assertion)
|
||||||
InvalidSchemaError = Class.new(StandardError)
|
InvalidSchemaError = Class.new(Minitest::Assertion)
|
||||||
|
|
||||||
class AssertResponseSchema
|
class AssertResponseSchema
|
||||||
attr_reader :schema_path, :response, :message
|
attr_reader :schema_path, :response, :message
|
||||||
|
|||||||
@ -102,14 +102,14 @@ module ActiveModelSerializers
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_with_a_non_existent_file
|
def test_with_a_non_existent_file
|
||||||
message = %r{.* - No Schema file at test/support/schemas/non-existent.json}
|
expected_message = 'No Schema file at test/support/schemas/non-existent.json'
|
||||||
|
|
||||||
get :show
|
get :show
|
||||||
|
|
||||||
error = assert_raises ActiveModelSerializers::Test::Schema::MissingSchema do
|
error = assert_raises ActiveModelSerializers::Test::Schema::MissingSchema do
|
||||||
assert_response_schema('non-existent.json')
|
assert_response_schema('non-existent.json')
|
||||||
end
|
end
|
||||||
assert_match(message, error.message)
|
assert_equal(expected_message, error.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_that_raises_with_a_invalid_json_body
|
def test_that_raises_with_a_invalid_json_body
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user