Sha256: 6a343504ea49d7c8d2d0958deca6be5d1d5d1078a044bc8caa1e77046869a379

Contents?: true

Size: 1007 Bytes

Versions: 1

Compression:

Stored size: 1007 Bytes

Contents

# frozen_string_literal: true

module RSpec
  module Grape
    module Entity
      module Matchers
        module BeAExposureTypeMatcher
          extend RSpec::Matchers::DSL

          EXPOSURE_TYPES = %i[block delegator formatter_block formatter nesting represent].freeze

          matcher :be_a_exposure_type do |expected|
            include MatcherHelpers

            match { |actual| actual.is_a? exposure_type(expected) }
            description { "be exposure type #{expected}" }
            failure_message { |actual| "expect that #{actual} to be a #{expected} exposure" }
          end

          EXPOSURE_TYPES.each do |type|
            matcher :"be_a_#{type}_exposure" do
              include MatcherHelpers

              match { |actual| actual.is_a? exposure_type(type) }
              description { "be a #{type} exposure" }
              failure_message { |actual| "expect that #{actual} to be a #{type} exposure" }
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-grape-entity-0.1.0 lib/rspec_grape_entity/matchers/be_a_exposure_type_matcher.rb