Sha256: 9942acf3a8240dc5854152e5e7f5c70b9812ec49a82e100da84225f333c454fa

Contents?: true

Size: 568 Bytes

Versions: 1

Compression:

Stored size: 568 Bytes

Contents

# frozen_string_literal: true

module RSpec
  module Grape
    module Entity
      module Matchers
        module MatcherHelpers
          def entity_class_name(entity)
            entity.try(:name) || entity.class.name
          end

          def exposure_attribute(exposure, name)
            exposure.send name
          end

          def exposure_type(type)
            type = type.to_s.split("_").map { |w| w[0].upcase + w[1..] }.join
            Object.const_get "Grape::Entity::Exposure::#{type}Exposure"
          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/matcher_helpers.rb