# frozen_string_literal: true
#--
# gravaty
# rubocop:disable Style/AsciiComments
# © 2013 Marco Bresciani
# rubocop:enable Style/AsciiComments
#
# This file is part of gravaty.
#
# gravaty is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# gravaty is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with gravaty. If not, see .
#
# SPDX-FileCopyrightText: 2013 Marco Bresciani
#
# SPDX-License-Identifier: GPL-3.0-or-later
#++
require 'simplecov'
SimpleCov.start
require 'json'
require 'minitest/autorun'
require 'minitest/spec'
require_relative '../lib/gravaty'
require_relative '../lib/gravaty/constants'
require_relative '../lib/gravaty/parsers/avatar'
require_relative '../lib/gravaty/parsers/callback'
require_relative '../lib/gravaty/parsers/default'
require_relative '../lib/gravaty/parsers/force'
require_relative '../lib/gravaty/parsers/format'
require_relative '../lib/gravaty/parsers/pixelsize'
require_relative '../lib/gravaty/parsers/rating'
require_relative '../lib/gravaty/parsers/secure'
require_relative '../lib/gravaty/parsers/type'
require_relative '../lib/gravaty/utils/rpc_connector'
module Gravaty
# Example mail address for testing purposes.
TEST_MY_ADDRESS = '"Example User" '
# Example MD5'ed mail address for testing purposes.
TEST_MY_MD5 = Digest::MD5.hexdigest TEST_MY_ADDRESS.downcase
# Example basic URI (profile part) for testing purposes.
TEST_BASIC_PROFILE = 'gravatar.com/'
# Example basic URI (avatar part) for testing purposes.
TEST_BASIC_AVATAR = "#{TEST_BASIC_PROFILE}avatar/"
# Example generic callback string for testing purposes.
TEST_CALLBACK = 'my_test_callback'
# Example resulting query string when forced default for testing
# purposes.
TEST_FORCED = 'f=y'
# Example json file extension regular expression for testing
# purposes.
TEST_JSON_REGEXP = /.json$/
# Example QRCode file extension regular expression for testing
# purposes.
TEST_QR_REGEXP = /.qr$/
# Example secure (HTTPS) URI header regular expression for testing
# purposes.
TEST_SECURE_URI_REGEXP = %r{\Ahttps://secure.}
# Example unsecure (HTTP) URI header regular expression for testing
# purposes.
TEST_UNSECURE_URI_REGEXP = %r{\Ahttp://}
# Example simple (HTTP) URI header regular expression for testing
# purposes.
TEST_SIMPLE_URI_REGEXP = /\Ahttp/
# Example size string regular expression for testing purposes.
TEST_SIZE_REGEXP = /s=\d\d?\d?\d?/
# Example hash with basic URI parts for testing purposes.
TEST_STRING = { avatar: TEST_BASIC_AVATAR, profile: TEST_BASIC_PROFILE }.freeze
# This module represents the parsable duck type element for testing
# purposes.
#
# Author:: {Marco Bresciani}[mailto:marcobresciani_1974@libero.it]
# rubocop:disable Style/AsciiComments
# Copyright:: Copyright © 2013, 2014, 2015, 2016, 2017, 2018,
# 2019 Marco Bresciani
# rubocop:enable Style/AsciiComments
# License:: GNU General Public License version 3
module ParsableDuckType
# The method that tests the parsable duck type interface and its
# +parse+ method.
def test_parsable_duck_type
_(subject).must_respond_to :parse unless subject.nil?
end
end
end