Sha256: 13e93c4c7a1249b9dc0796d29cbf256a3b6b75be8dd6740d4657efe3155f7080
Contents?: true
Size: 1.03 KB
Versions: 6
Compression:
Stored size: 1.03 KB
Contents
module InfinumJsonApiSetup module RSpec module Matchers # @param [String] type # @param [Integer] id # @return [InfinumJsonApiSetup::Rspec::Matchers::IncludeRelatedResource] def include_related_resource(type, id) IncludeRelatedResource.new(type, id) end class IncludeRelatedResource < JsonBodyMatcher # @param [String] type # @param [Integer] id def initialize(type, id) super(Matchers::Util::BodyParser.new('included')) @type = type @id = id end private attr_reader :id attr_reader :included attr_reader :pointer attr_reader :type def body_matches? included.one? { |item| item['type'] == type && item['id'].to_i == id } end def match_failure_message "Expected included items to include (type = #{type}, id = #{id}), but didn't" end def process_parsing_result(result) @included = result end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems