Skip to content

Instantly share code, notes, and snippets.

@Edouard-chin
Created January 29, 2016 09:21
Show Gist options
  • Save Edouard-chin/20cff74c7ea2fdc832d5 to your computer and use it in GitHub Desktop.
Save Edouard-chin/20cff74c7ea2fdc832d5 to your computer and use it in GitHub Desktop.
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'rack', github: 'rack/rack'
gem 'sprockets', github: 'rails/sprockets'
gem 'sprockets-rails', github: 'rails/sprockets-rails'
gem 'sass-rails', github: 'rails/sass-rails'
end
require 'action_mailer'
require 'active_support'
require 'active_support/core_ext/object/blank'
require 'active_support/test_case'
require 'minitest/autorun'
# Ensure backward compatibility with Minitest 4
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
class SimpleMailer < ActionMailer::Base
include ActionView::Helpers::AssetTagHelper
def welcome
attachments.inline['an image.jpg'] = File.read('/tmp/8122246.jpeg')
mail(to: 'john@example.com', subject: "test") do |format|
format.html { render html: image_tag(attachments['an image.jpg'].url) }
end
end
end
class BugTest < ActiveSupport::TestCase
def test_stuff
assert_nothing_raised do
SimpleMailer.welcome
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment