Sha256: 1eff8b8445ef1bad17e433d5101c8e8cb9b63ecb142764e7b17c03990969a839

Contents?: true

Size: 1.46 KB

Versions: 3

Compression:

Stored size: 1.46 KB

Contents

require 'bundler/gem_tasks'

desc 'Run minitest tests in ./test'
task test: [:load_minitest, :clean_artifacts] do
  Dir.glob("#{File.expand_path('../test', __FILE__)}/*_test.rb").each do |f|
    require f
  end

  mkdir_p(File.expand_path('../.artifacts', __FILE__))
  exit(MiniTest::Unit.new.run(%W(#{ENV['MINITEST_ARGS'] || ''})) || 1)
end

task :load_minitest do
  require 'minitest/spec'
end

task :clean_artifacts do
  rm_rf(File.expand_path('../.artifacts', __FILE__))
end

desc 'Send a test email to a local SMTP server (on $PORT)'
task :send_email do
  smtp_port = Integer(ENV['PORT'])
  require 'net/smtp'
  msg = <<-EOMSG.gsub(/^ {4}/, '')
    From: Fake SMTPd <fakesmtpd@example.org>
    To: Recipient Person <recipient@example.org>
    Subject: Test Sandwich
    Date: Sun, 11 Aug 2013 21:54:13 +0500
    Message-Id: <this.sandwich.is.a.test.#{rand(999..1999)}@example.org>

    Why have one sandwich when you can have #{rand(2..9)}?
                          ____
              .----------'    '-.
             /  .      '     .   \\
            /        '    .      /|
           /      .             \ /
          /  ' .       .     .  || |
         /.___________    '    / //
         |._          '------'| /|
         '.............______.-' /
     jgs |-.                  | /
         `"""""""""""""-.....-'

  EOMSG
  Net::SMTP.start('localhost', smtp_port) do |smtp|
    smtp.send_message(msg, 'fakesmtpd@example.org', 'recipient@example.org')
  end
end

task default: :test

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fakesmtpd-0.3.1 Rakefile
fakesmtpd-0.3.0 Rakefile
fakesmtpd-0.2.0 Rakefile