Sha256: c4390e7455a5127d7c54b14c128c1b99b8149155acd086c108c5523f06d8e508

Contents?: true

Size: 415 Bytes

Versions: 1

Compression:

Stored size: 415 Bytes

Contents

module Rack
  module MockJson
    class Mock
      def initialize(config_file_path)
        @config = YAML.load_file(config_file_path)
      end

      def mock_element(path)
        element = @config.find { |e| path.match(/#{e["request_path"]}/).present? }
        return nil if element.blank?

        element = Hashie::Mash.new(element)
        element.status ||= 200
        element
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rack-mock_json-0.0.2 lib/rack/mock_json/mock.rb