Sha256: 209433905f8640e5fddaf736f5cb0100e5a0d29fedddfaef72a419cb00d70519
Contents?: true
Size: 936 Bytes
Versions: 6
Compression:
Stored size: 936 Bytes
Contents
module InfinumJsonApiSetup module RSpec module Matchers # @param [String] error_detail # @return [InfinumJsonApiSetup::Rspec::Matchers::IncludeErrorDetail] def include_error_detail(error_detail) IncludeErrorDetail.new(error_detail) end class IncludeErrorDetail < JsonBodyMatcher # @param [String] error_detail def initialize(error_detail) super(Matchers::Util::BodyParser.new('errors')) @error_detail = error_detail end private attr_reader :error_detail attr_reader :errors def body_matches? errors.any? { |error| error['detail'].include?(error_detail) } end def match_failure_message "Expected error details to include '#{error_detail}', but didn't" end def process_parsing_result(result) @errors = result end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems