Sha256: 80f6407671e085c8960ee2d4d69eb93c4d4fe9255f34a3dc096c5c30a44d05ea

Contents?: true

Size: 597 Bytes

Versions: 3

Compression:

Stored size: 597 Bytes

Contents

# frozen_string_literal: true

module RSpec
  module GraphqlMatchers
    module HaveAFieldMatchers
      class WithMetadata
        def initialize(expected_metadata)
          @expected_metadata = expected_metadata
        end

        def description
          "with metadata `#{@expected_metadata}`"
        end

        def matches?(actual_field)
          @actual_metadata = actual_field.metadata
          actual_field.metadata == @expected_metadata
        end

        def failure_message
          "#{description}, but it was `#{@actual_metadata}`"
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rspec-graphql_matchers-2.0.0.pre.rc.0 lib/rspec/graphql_matchers/have_a_field_matchers/with_metadata.rb
rspec-graphql_matchers-1.4.0 lib/rspec/graphql_matchers/have_a_field_matchers/with_metadata.rb
rspec-graphql_matchers-1.3.1 lib/rspec/graphql_matchers/have_a_field_matchers/with_metadata.rb