Sha256: a9b144ffb78395b6255e639129b67d22d9aeae44b2ea7429189763341c83090d

Contents?: true

Size: 581 Bytes

Versions: 1

Compression:

Stored size: 581 Bytes

Contents

module Restorm
  module Testing
    module Macros
      module RequestMacros
        def ok!(body)
          [200, {}, body.to_json]
        end

        def error!(body)
          [400, {}, body.to_json]
        end

        def params(env)
          @params ||= begin
            parsed_query = Faraday::Utils.parse_nested_query(env[:body])

            if parsed_query
              parsed_query.with_indifferent_access.merge(env[:params])
            else
              env[:params].with_indifferent_access
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
restorm-1.0.0 spec/support/macros/request_macros.rb