repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/lib/kramdown/converter/odin_html.rb | lib/kramdown/converter/odin_html.rb | # All Kramdown methods that can be overridden are listed here: https://kramdown.gettalong.org/rdoc/Kramdown/Converter/Html.html
require 'kramdown/converter/html'
module Kramdown
module Converter
module OdinHtml
HEADER_LEVELS_TO_CONVERT = [3, 4].freeze
EXTERNAL_LINK_ATTRIBUTES = { target: '_blank', re... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/lib/kramdown/converter/html_sections.rb | lib/kramdown/converter/html_sections.rb | require './lib/kramdown/content_section'
class Kramdown::Converter::HtmlSections < Kramdown::Converter::Html
H3_HEADER = 3
TOP_LEVEL_ELEMENT = 0
def convert(element, _indent = -@indent)
@content_sections = []
super
@content_sections
end
def convert_header(element, indent)
if element.options... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/lib/generators/rails/seed_uuids/seed_uuids_generator.rb | lib/generators/rails/seed_uuids/seed_uuids_generator.rb | require 'rails/generators'
class Rails::SeedUuidsGenerator < Rails::Generators::Base
def generate_uuids
seed_files = Dir.glob('db/fixtures/**/*').reject { |f| File.directory?(f) }
seed_files.each do |file_name|
gsub_file file_name, 'create_uuid' do
SecureRandom.uuid
end
end
end
end... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/application.rb | config/application.rb | require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Theodinproject
class Application < Rails::Application
# Initialize configuration defaults for originally generated ... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/environment.rb | config/environment.rb | # Load the Rails application.
require_relative 'application'
# Initialize the Rails application.
Rails.application.initialize!
| ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/puma.rb | config/puma.rb | # This configuration file will be evaluated by Puma. The top-level methods that
# are invoked here are part of Puma's configuration DSL. For more information
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
#
# Puma starts a configurable number of processes (workers) and each process
# serve... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/routes.rb | config/routes.rb | Rails.application.routes.draw do
match '/404' => 'errors#not_found', via: :all
match '422' => 'errors#unprocessable_entity', via: :all
match '500' => 'errors#internal_server_error', via: :all
get 'up' => 'rails/health#show', as: :rails_health_check
draw(:redirects)
if Rails.env.development?
mount Loo... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/puma_development.rb | config/puma_development.rb | # Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/boot.rb | config/boot.rb | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' # Set up gems listed in the Gemfile.
require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
| ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/content_security_policy.rb | config/initializers/content_security_policy.rb | # Be sure to restart your server when you modify this file.
# Define an application-wide content security policy.
# See the Securing Rails Applications Guide for more information:
# https://guides.rubyonrails.org/security.html#content-security-policy-header
# Rails.application.configure do
# config.content_security... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/filter_parameter_logging.rb | config/initializers/filter_parameter_logging.rb | # Be sure to restart your server when you modify this file.
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
# Use this to limit dissemination of sensitive information.
# See the ActiveSupport::ParameterFilter documentation for supported notations and behavio... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/application_controller_renderer.rb | config/initializers/application_controller_renderer.rb | # Be sure to restart your server when you modify this file.
# ActiveSupport::Reloader.to_prepare do
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
# end
| ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/sidekiq.rb | config/initializers/sidekiq.rb | Sidekiq.configure_server do |config|
config.redis = { url: ENV['REDIS_URL'], ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE } }
end
Sidekiq.configure_client do |config|
config.redis = { url: ENV['REDIS_URL'], ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE } }
end
Sidekiq.configure_client do |config|
... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/session_store.rb | config/initializers/session_store.rb | # Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_theodinproject_session'
| ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/friendly_id.rb | config/initializers/friendly_id.rb | # FriendlyId Global Configuration
#
# Use this to set up shared configuration options for your entire application.
# Any of the configuration options shown here can also be applied to single
# models by passing arguments to the `friendly_id` class method or defining
# methods in your model.
#
# To learn more, check out... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/devise.rb | config/initializers/devise.rb | # rubocop:disable Lint/MissingCopEnableDirective, Layout/LineLength
Devise.setup do |config|
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
config.mailer_sender = ... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/pagy.rb | config/initializers/pagy.rb | # frozen_string_literal: true
# Pagy initializer file (5.10.1)
# Customize only what you really need and notice that the core Pagy works also without any of the following lines.
# Should you just cherry pick part of this file, please maintain the require-order of the extras
# Pagy DEFAULT Variables
# See https://ddne... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/date_time_formats.rb | config/initializers/date_time_formats.rb | # 2024
Time::DATE_FORMATS[:graph_year] = '%Y'
# Jun, 2024
Time::DATE_FORMATS[:graph_month] = '%b %Y'
# Tue, Jun 01, 2024
Time::DATE_FORMATS[:graph_day] = '%a, %b %d'
| ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/wrap_parameters.rb | config/initializers/wrap_parameters.rb | # Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters f... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/patch_enable_extension.rb | config/initializers/patch_enable_extension.rb | require 'active_record/connection_adapters/postgresql_adapter'
# NOTE: patch for https://devcenter.heroku.com/changelog-items/2446
# Source: https://stackoverflow.com/questions/73214844/error-extension-btree-gist-must-be-installed-in-schema-heroku-ext/73289426#73289426
module EnableExtensionHerokuPatch
def enable_ex... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/omniauth.rb | config/initializers/omniauth.rb | OmniAuth.config.logger = Rails.logger
| ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/inflections.rb | config/initializers/inflections.rb | # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflec... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/smtp.rb | config/initializers/smtp.rb | Rails.application.config.after_initialize do
ActionMailer::Base.smtp_settings = {
address: ENV['MAILGUN_SMTP_SERVER'],
port: ENV['MAILGUN_SMTP_PORT'],
authentication: :plain,
user_name: ENV['MAILGUN_SMTP_LOGIN'],
password: ENV['MAILGUN_SMTP_PASSWORD'],
domain: ENV['MAILGUN_DOMAIN'],
}
end
| ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/cookies_serializer.rb | config/initializers/cookies_serializer.rb | # Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
Rails.application.config.action_dispatch.cookies_serializer = :hybrid
| ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/permissions_policy.rb | config/initializers/permissions_policy.rb | # Be sure to restart your server when you modify this file.
# Define an application-wide HTTP permissions policy. For further
# information see: https://developers.google.com/web/updates/2018/06/feature-policy
# Rails.application.config.permissions_policy do |policy|
# policy.camera :none
# policy.gyroscope ... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/odin_configuration.rb | config/initializers/odin_configuration.rb | ODIN_BLOG_URL = 'https://dev.to/theodinproject'.freeze
ODIN_CHAT_URL = 'https://discord.gg/fbFCkYabZB'.freeze
CONTACT_EMAIL = 'contact@theodinproject.com'.freeze
| ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/assets.rb | config/initializers/assets.rb | # Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
| ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/octokit.rb | config/initializers/octokit.rb | Octokit.configure do |config|
config.access_token = ENV['GITHUB_API_TOKEN']
config.client_id = ENV['GITHUB_APP_ID']
config.client_secret = ENV['GITHUB_SECRET']
end
| ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/sentry.rb | config/initializers/sentry.rb | Sentry.init do |config|
config.dsn = ENV['SENTRY_DSN']
config.enabled_environments = %w[production]
config.breadcrumbs_logger = %i[active_support_logger http_logger]
config.send_default_pii = true
# enable tracing
config.traces_sample_rate = 0.1
# enable profiling
# this is relative to traces_sample_r... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/backtrace_silencers.rb | config/initializers/backtrace_silencers.rb | # Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
# You can also remove all the silencers if you're trying to debug a ... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/mime_types.rb | config/initializers/mime_types.rb | # Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
| ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/initializers/rack_attack.rb | config/initializers/rack_attack.rb | class Rack::Attack
# Rack::Attack.cache.store = Redis.new(url: ENV['REDIS_FOR_RACK_ATTACK_URL']) if ENV['REDIS_FOR_RACK_ATTACK_URL']
### Throttle Spammy Clients ###
# If any single client IP is making tons of requests, then they're
# probably malicious or a poorly-configured scraper. Either way, they
# don'... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/routes/redirects.rb | config/routes/redirects.rb | require_relative 'redirectors/nested_lesson_redirector'
Rails.application.routes.draw do
get '/courses/web-development-101(/lessons/:id)', to: redirect('/paths/foundations')
get '/paths/:path_id/courses/:course_id/lessons/:id', to: redirect(Redirectors::NestedLessonRedirector.new)
get '/discord', to: redirect(ODI... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/routes/admin.rb | config/routes/admin.rb | require 'sidekiq/web'
require 'sidekiq/cron/web'
devise_for :admin_users, path: :admin, module: :admin
namespace :admin do # rubocop:disable Metrics/BlockLength
root to: 'dashboard#show'
resource :dashboard, only: :show, controller: :dashboard
authenticate :admin_user do
mount Sidekiq::Web => '/sidekiq'
... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/routes/redirectors/nested_lesson_redirector.rb | config/routes/redirectors/nested_lesson_redirector.rb | module Redirectors
class NestedLessonRedirector
def call(params, request)
path = lesson_path(params[:course_id], params[:id])
"http://#{request.host_with_port}/#{path}"
end
private
def lesson_path(course_id, lesson_id)
lesson = ::Course.find(course_id).lessons.find(lesson_id)
... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/environments/test.rb | config/environments/test.rb | # The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
Rails.application.configure do
# Settings... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/environments/development.rb | config/environments/development.rb | require 'active_support/core_ext/integer/time'
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Make code changes take effect immediately without server restart.
config.enable_reloading = true
# Do not eager load code on boot.
config.eager... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
TheOdinProject/theodinproject | https://github.com/TheOdinProject/theodinproject/blob/bc97027b6e48d5197a4e88f4b05b9c4341c19b3a/config/environments/production.rb | config/environments/production.rb | require 'active_support/core_ext/integer/time'
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.enable_reloading = false
routes.default_url_options = { host: 'www.theodinproject.com', protocol: '... | ruby | MIT | bc97027b6e48d5197a4e88f4b05b9c4341c19b3a | 2026-01-04T15:46:55.521218Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/environment.rb | spec/environment.rb | # frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
begin
require 'byebug'
rescue LoadError
end
require 'mail'
if ENV['MBCHARS'] == 'activesupport'
require 'active_support'
Mail::Multibyte.proxy_class = ActiveSupport::Multibyte::Chars
else
require 'mail/multibyte/chars'
Mai... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/matchers_spec.rb | spec/matchers_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe "have_sent_email" do
include Mail::Matchers
let(:include_attachments) { true }
let(:test_mail) do
mail = Mail.new(
:from => 'phil@example.com',
:to => ['bob@example.com', 'fred@example.com'],
:cc => ['dad@e... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/spec_helper.rb | spec/spec_helper.rb | # encoding: utf-8
# frozen_string_literal: true
require_relative 'environment'
unless defined?(MAIL_ROOT)
$stderr.puts("Running Specs under Ruby Version #{RUBY_VERSION}")
MAIL_ROOT = File.join(__dir__, '../')
end
unless defined?(SPEC_ROOT)
SPEC_ROOT = __dir__
end
unless defined?(MAIL_SPEC_SUITE_RUNNING)
# U... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/mail_spec.rb | spec/mail/mail_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe "mail" do
it "should be able to be instantiated" do
expect { Mail }.not_to raise_error
end
it "should be able to make a new email" do
expect(Mail.new.class).to eq Mail::Message
end
it "should accept headers and ... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/header_spec.rb | spec/mail/header_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::Header do
describe "initialization" do
it "should instantiate empty" do
expect { Mail::Header.new }.not_to raise_error
end
it "should instantiate with a string passed in" do
expect { Mail::Header.new... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/parts_list_spec.rb | spec/mail/parts_list_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe "PartsList" do
it "should return itself on sort" do
p = Mail::PartsList.new
p << 2
p << 1
expect(p.sort.class).to eq Mail::PartsList
end
it "should not fail if we do not have a content_type" do
p = Mail::Pa... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/encoding_spec.rb | spec/mail/encoding_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe "mail encoding" do
it "should allow you to assign an email-wide charset" do
mail = Mail.new
mail.charset = 'utf-8'
expect(mail.charset).to eq 'utf-8'
end
describe "using default encoding" do
it "should allow yo... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/network_spec.rb | spec/mail/network_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
class MyDelivery; def initialize(settings); end; end
class MyRetriever; def initialize(settings); end; end
RSpec.describe "Mail" do
before(:each) do
# Reset all defaults back to original state
Mail.defaults do
delivery_method :smt... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/multipart_report_spec.rb | spec/mail/multipart_report_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe "multipart/report emails" do
it "should know if it is a multipart report type" do
mail = read_fixture('emails', 'multipart_report_emails', 'report_422.eml')
expect(mail).to be_multipart_report
end
describe "delivery-... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/field_spec.rb | spec/mail/field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::Field do
describe 'parsing' do
it "parses full header fields" do
field = nil
expect {
field = Mail::Field.parse('To: Mikel')
}.to_not output.to_stderr
expect(field.name).to eq 'To'
e... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/message_spec.rb | spec/mail/message_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::Message do
def basic_email
"To: mikel\r\nFrom: bob\r\nSubject: Hello!\r\n\r\nemail message\r\n"
end
describe "initialization" do
it "should instantiate empty" do
expect(Mail::Message.new.class).to eq Mail:... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | true |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/configuration_spec.rb | spec/mail/configuration_spec.rb | # frozen_string_literal: true
require 'spec_helper'
class MyTestDeliveryMethod
attr_accessor :settings
def initialize(values)
self.settings = {}.merge!(values)
end
end
RSpec.describe Mail::Configuration do
describe "network configurations" do
it "defaults delivery_method to smtp" do
# Need to... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/core_extensions_spec.rb | spec/mail/core_extensions_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Object do
end
| ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/example_emails_spec.rb | spec/mail/example_emails_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe "Test emails" do
describe "from RFC2822" do
# From RFC 2822:
# This could be called a canonical message. It has a single author,
# John Doe, a single recipient, Mary Smith, a subject, the date, a
# message identif... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/encodings_spec.rb | spec/mail/encodings_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::Encodings do
describe "base64 Encoding" do
it "should return true for base64" do
expect(Mail::Encodings.defined?('base64')).to be_truthy
end
it "should return true for Base64" do
expect(Mail::Encodin... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | true |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/field_list_spec.rb | spec/mail/field_list_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::FieldList do
it "should be able to add new fields" do
fl = Mail::FieldList.new
fl << Mail::Field.parse("To: mikel@me.com")
fl << Mail::Field.parse("From: mikel@me.com")
expect(fl.map(&:name)).to eq %w[ From To ]
end
it "sho... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/round_tripping_spec.rb | spec/mail/round_tripping_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe "Round Tripping" do
it "should round trip a basic email" do
mail = Mail.new('Subject: FooBar')
mail.body "This is Text"
parsed_mail = Mail.new(mail.to_s)
expect(parsed_mail.subject.to_s).to eq "FooBar"
expect(pa... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/multibyte_spec.rb | spec/mail/multibyte_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
require 'mail/multibyte/chars'
RSpec.describe Mail::Multibyte::Chars do
it "should upcase" do
chars = described_class.new('Laurent, où sont les tests ?')
expect(chars.upcase).to eq("LAURENT, OÙ SONT LES TESTS ?")
end
it "should downca... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/attachments_list_spec.rb | spec/mail/attachments_list_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
def encode_base64(str)
Mail::Encodings::Base64.encode(str)
end
def check_decoded(actual, expected)
expect(actual.encoding).to eq Encoding::BINARY
expect(actual).to eq expected.dup.force_encoding(Encoding::BINARY)
end
RSpec.describe "Attachme... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/body_spec.rb | spec/mail/body_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::Body do
# 3.5 Overall message syntax
#
# A message consists of header fields, optionally followed by a message
# body. Lines in a message MUST be a maximum of 998 characters
# excluding the CRLF, but it is RECOMMENDE... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/utilities_spec.rb | spec/mail/utilities_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe "Utilities Module" do
include Mail::Utilities
describe "token safe" do
describe "checking" do
it "should return true if a string is token safe" do
expect(token_safe?('.abc')).to be_truthy
end
it "... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/part_spec.rb | spec/mail/part_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::Part do
it "should not add a default Content-ID" do
part = Mail::Part.new
part.to_s
expect(part.content_id).to be_nil
end
it "should not add a default Content-ID to non-inline attachments" do
part = Mail::Part.new(:content... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/yaml_spec.rb | spec/mail/yaml_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::YAML do
describe "#load" do
it 'loads YAML' do
expect(Mail::YAML.load('{}')).to eq({})
end
end
end
| ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/mime_messages_spec.rb | spec/mail/mime_messages_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe "MIME Emails" do
describe "general helper methods" do
it "should read a mime version from an email" do
mail = Mail.new("MIME-Version: 1.0")
expect(mail.mime_version).to eq '1.0'
end
it "should ... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/encodings/base64_spec.rb | spec/mail/encodings/base64_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::Encodings::Base64 do
it "should encode base 64 from text" do
result = "VGhpcyBpcyBhIHRlc3Q=\r\n"
expect(Mail::Encodings::Base64.encode('This is a test')).to eq result
end
it "should decode base 64 text" do
result = 'This is ... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/encodings/transfer_encoding_spec.rb | spec/mail/encodings/transfer_encoding_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::Encodings::TransferEncoding do
it "accepts blank message_encoding" do
expect(described_class.negotiate('', '7bit', '')).to eq Mail::Encodings::SevenBit
expect(described_class.negotiate('', '8bit', '')).to eq Mail::Encodings::EightBit
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/encodings/quoted_printable_spec.rb | spec/mail/encodings/quoted_printable_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::Encodings::QuotedPrintable do
it "should encode quoted printable from text" do
result = "This is\r\na test=\r\n"
expect(Mail::Encodings::QuotedPrintable.encode("This is\na test")).to eq result
end
it "should encode quoted printabl... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/encodings/unix_to_unix_spec.rb | spec/mail/encodings/unix_to_unix_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::Encodings::UnixToUnix do
def decode(str)
Mail::Encodings::UnixToUnix.decode(str)
end
def encode(str)
Mail::Encodings::UnixToUnix.encode(str)
end
it "is registered as uuencode" do
expect(Mail::Encodings.ge... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/elements/date_time_element_spec.rb | spec/mail/elements/date_time_element_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::DateTimeElement do
it "should parse a date" do
date_text = 'Wed, 27 Apr 2005 14:15:31 -0700'
expect { Mail::DateTimeElement.new(date_text) }.not_to raise_error
end
it "should raise an error if the input is nil" do
date_text =... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/elements/address_list_spec.rb | spec/mail/elements/address_list_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::AddressList do
describe "parsing" do
it "should parse an address list" do
parse_text = 'test@lindsaar.net'
expect { Mail::AddressList.new(parse_text) }.not_to raise_error
end
it "should raise an erro... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/elements/message_ids_element_spec.rb | spec/mail/elements/message_ids_element_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::MessageIdsElement do
it "should parse a message_id" do
msg_id_text = '<1234@test.lindsaar.net>'
expect { Mail::MessageIdsElement.new(msg_id_text) }.not_to raise_error
end
it "should parse multiple message_ids" do
msg_id_text ... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/elements/envelope_from_element_spec.rb | spec/mail/elements/envelope_from_element_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::EnvelopeFromElement do
describe "parsing a from envelope string" do
it "should parse a full field" do
expect { Mail::EnvelopeFromElement.new("mikel@test.lindsaar.net Mon Aug 7 00:39:21 2009") }.not_to raise_error
end
it "s... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/elements/phrase_list_spec.rb | spec/mail/elements/phrase_list_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::PhraseList do
describe "parsing" do
it "should parse a phrase list" do
parse_text = '"Mikel Lindsaar", "Mikel", you, somewhere'
expect { Mail::PhraseList.new(parse_text) }.not_to raise_error
end
it "... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/elements/received_element_spec.rb | spec/mail/elements/received_element_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::ReceivedElement do
it "should raise an error if the input is nil" do
received = Mail::ReceivedElement.new(nil)
expect(received.info).to be_nil
expect(received.date_time).to be_nil
end
it "should raise an error if the input is ... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/elements/address_spec.rb | spec/mail/elements/address_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::Address do
describe "functionality" do
it "should allow us to instantiate an empty address object and call inspect" do
expect {
Mail::Address.new.inspect
}.not_to raise_error
end
it "should a... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | true |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/network/delivery_methods/file_delivery_spec.rb | spec/mail/network/delivery_methods/file_delivery_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe "SMTP Delivery Method" do
before(:each) do
# Reset all defaults back to an original state
Mail.defaults do
delivery_method :smtp, { :address => "localhost",
:port ... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/network/delivery_methods/smtp_spec.rb | spec/mail/network/delivery_methods/smtp_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe "SMTP Delivery Method" do
before(:each) do
MockSMTP.reset
# Reset all defaults back to original state
Mail.defaults { delivery_method :smtp, {} }
end
describe "general usage" do
it "should send emails from giv... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/network/delivery_methods/smtp_connection_spec.rb | spec/mail/network/delivery_methods/smtp_connection_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe "SMTP Delivery Method" do
before(:each) do
Mail.defaults do
smtp = Net::SMTP.start('127.0.0.1', 25)
delivery_method :smtp_connection, :connection => smtp
end
end
after(:each) do
Mail.delivery_method.smt... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/network/delivery_methods/exim_spec.rb | spec/mail/network/delivery_methods/exim_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe "exim delivery agent" do
let :mail do
Mail.new do
from 'roger@test.lindsaar.net'
to 'marcel@test.lindsaar.net, bob@test.lindsaar.net'
subject 'some subject'
end
end
before do
Mail.defaults ... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/network/delivery_methods/logger_delivery_spec.rb | spec/mail/network/delivery_methods/logger_delivery_spec.rb | # encoding: utf-8
require 'spec_helper'
require 'logger'
require 'stringio'
RSpec.describe "Logger Delivery Method" do
before(:each) do
# Reset all defaults back to original state
Mail.defaults do
delivery_method :smtp,
:address => "localhost",
:port => 25,
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/network/delivery_methods/test_mailer_spec.rb | spec/mail/network/delivery_methods/test_mailer_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe "Mail::TestMailer" do
before(:each) do
# Reset all defaults back to original state
Mail.defaults do
delivery_method :smtp, { :address => "localhost",
:port =>... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/network/delivery_methods/sendmail_spec.rb | spec/mail/network/delivery_methods/sendmail_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::Sendmail do
let :mail do
Mail.new do
from 'roger@test.lindsaar.net'
to 'marcel@test.lindsaar.net, bob@test.lindsaar.net'
subject 'some subject'
end
end
before do
Mail.defaults do
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/network/retriever_methods/pop3_spec.rb | spec/mail/network/retriever_methods/pop3_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe "POP3 Retriever" do
before(:each) do
# Reset all defaults back to original state
Mail.defaults do
retriever_method :pop3, { :address => "localhost",
:port => ... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/network/retriever_methods/imap_spec.rb | spec/mail/network/retriever_methods/imap_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe "IMAP Retriever" do
before(:each) do
Mail.defaults do
retriever_method :imap, { :address => 'localhost',
:port => 993,
:user_name => nil,
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/network/retriever_methods/test_retriever_spec.rb | spec/mail/network/retriever_methods/test_retriever_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe "Test Retriever" do
before(:each) do
Mail.defaults do
retriever_method :test
end
end
it "should have no emails initially" do
expect(Mail.all).to be_empty
end
describe "all" do
before do
@emails = populate(15)
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/parsers/content_transfer_encoding_parser_spec.rb | spec/mail/parsers/content_transfer_encoding_parser_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe "ContentTransferEncodingParser" do
it "should work" do
text = "quoted-printable"
a = Mail::Parsers::ContentTransferEncodingParser
expect(a.parse(text).error).to be_nil
expect(a.parse(text).encoding).to eq 'quoted-pr... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/parsers/address_lists_parser_spec.rb | spec/mail/parsers/address_lists_parser_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe "AddressListsParser" do
it "should parse an address" do
text = 'Mikel Lindsaar <test@lindsaar.net>, Friends: test2@lindsaar.net, Ada <test3@lindsaar.net>;'
a = Mail::Parsers::AddressListsParser
expect(a.parse(text)).not_... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/to_field_spec.rb | spec/mail/fields/to_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::ToField do
#
# The "To:" field contains the address(es) of the primary recipient(s)
# of the message.
describe "initialization" do
it "should initialize" do
expect { Mail::ToField.new("Mikel") }.not_to... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/in_reply_to_field_spec.rb | spec/mail/fields/in_reply_to_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
#
# The "In-Reply-To:" field will contain the contents of the "Message-
# ID:" field of the message to which this one is a reply (the "parent
# message"). If there is more than one parent message, then the "In-
# Reply-To:" field will co... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/envelope_spec.rb | spec/mail/fields/envelope_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::Envelope do
# From RFC4155 The application/mbox Media Type
#
# o Each message in the mbox database MUST be immediately preceded
# by a single separator line, which MUST conform to the following
# syntax:
#
# The exa... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/common_address_spec.rb | spec/mail/fields/common_address_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::CommonAddressField do
describe "address handling" do
it "should give the addresses it is going to" do
field = Mail::ToField.new("test1@lindsaar.net")
expect(field.addresses.first).to eq "test1@lindsaar.net"
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/parameter_hash_spec.rb | spec/mail/fields/parameter_hash_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::ParameterHash do
it "should return the values in the hash" do
hash = Mail::ParameterHash.new
hash.merge!({'value1' => 'one', 'value2' => 'two'})
expect(hash.keys).to include("value1")
expect(hash.keys).to inclu... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/content_description_field_spec.rb | spec/mail/fields/content_description_field_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::ContentDescriptionField do
# Content-Description Header Field
#
# The ability to associate some descriptive information with a given
# body is often desirable. For example, it may be useful to mark an
# "image" body as "a picture of th... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/reply_to_field_spec.rb | spec/mail/fields/reply_to_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
#
# reply-to = "Reply-To:" address-list CRLF
#
RSpec.describe Mail::ReplyToField do
describe "initialization" do
it "should initialize" do
expect { Mail::ReplyToField.new("Mikel") }.not_to raise_error
end
it "sh... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/resent_sender_field_spec.rb | spec/mail/fields/resent_sender_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
# resent-sender = "Resent-Sender:" mailbox CRLF
RSpec.describe Mail::ResentSenderField do
let :field do
Mail::ResentSenderField.new('Mikel Lindsaar <mikel@test.lindsaar.net>')
end
describe "initialization" do
it "should initi... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/resent_message_id_field_spec.rb | spec/mail/fields/resent_message_id_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::ResentMessageIdField do
it "should initialize" do
expect { Mail::ResentMessageIdField.new("<1234@test.lindsaar.net>") }.not_to raise_error
end
it "should accept a string without the field name" do
t = Mail::Resen... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/date_field_spec.rb | spec/mail/fields/date_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::DateField do
# The origination date field consists of the field name "Date" followed
# by a date-time specification.
#
# orig-date = "Date:" date-time CRLF
#
# The origination date specifies the ... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/mime_version_field_spec.rb | spec/mail/fields/mime_version_field_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::MimeVersionField do
# MIME-Version Header Field
#
# Since RFC 822 was published in 1982, there has really been only one
# format standard for Internet messages, and there has been little
# perceived need to declare the format standard i... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/sender_field_spec.rb | spec/mail/fields/sender_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
# sender = "Sender:" mailbox CRLF
RSpec.describe Mail::SenderField do
let :field do
Mail::SenderField.new('Mikel Lindsaar <mikel@test.lindsaar.net>')
end
describe "initialization" do
it "should initialize" do
expe... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/content_location_field_spec.rb | spec/mail/fields/content_location_field_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::ContentLocationField do
# Content-Location Header Field
#
describe "initialization" do
it "should initialize" do
expect { Mail::ContentLocationField.new("Content-Location", "7bit") }.not_to raise_error
end
it "should ac... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/keywords_field_spec.rb | spec/mail/fields/keywords_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::KeywordsField do
describe "initializing" do
it "should initialize" do
expect { Mail::KeywordsField.new("this, is, email") }.not_to raise_error
end
it "should accept a string without the field name" do
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/resent_to_field_spec.rb | spec/mail/fields/resent_to_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
#
# resent-to = "Resent-To:" address-list CRLF
RSpec.describe Mail::ResentToField do
describe "initialization" do
it "should initialize" do
expect { Mail::ResentToField.new("Mikel") }.not_to raise_error
end
it "s... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.