Sha256: 798fdfaeafeeb399ecd25857ee72cf93778c82b79ec4d4bd69f0e0e6c670fb99
Contents?: true
Size: 1.71 KB
Versions: 7
Compression:
Stored size: 1.71 KB
Contents
require 'rubygems' require 'spec' require 'rr' require 'ostruct' Spec::Runner.configure do |config| config.mock_with :rr end SPEC_ROOT = File.expand_path(File.dirname(__FILE__)) $LOAD_PATH.unshift(SPEC_ROOT + '/../lib') Dir[SPEC_ROOT + '/matchers/*.rb'].each { |path| require path } require 'active_record' SQLITE_DATABASE = "#{SPEC_ROOT}/sqlite3.db" ActiveRecord::Base.silence do ActiveRecord::Base.configurations = {'test' => { 'adapter' => 'sqlite3', 'database' => SQLITE_DATABASE }} ActiveRecord::Base.establish_connection 'test' load "#{SPEC_ROOT}/fixtures/schema.rb" end require 'dataset' class Spec::Example::ExampleGroup include Dataset datasets_directory "#{SPEC_ROOT}/datasets" end # Fixture helpers def email_fixtures_path(path) File.join(SPEC_ROOT, 'fixtures/email', path) end def email_fixture(path) File.read(email_fixtures_path(path)) end def tmail_fixture(path, header_changes = {}) tmail = TMail::Mail.parse(email_fixture(path)) header_changes.each do |k,v| tmail[k] = v end tmail end def html_fixtures_path(path) File.join(SPEC_ROOT, 'fixtures/html', path) end def html_fixture(path) File.read(html_fixtures_path(path)) end def text_fixtures_path(path) File.join(SPEC_ROOT, 'fixtures/text', path) end def text_fixture(path) File.read(text_fixtures_path(path)) end # To see the output of an email in your client, this will use sendmail to # deliver the email to the given address. It shouldn't be sent to the # addresses in to: cc: or bcc:, I hope. # def visualize_email(email, recipient_address) tf = Tempfile.new('email_visualize') tf.puts email.to_s tf.close `cat #{tf.path} | sendmail -t #{recipient_address}` end require 'mlist' require 'mlist/email_server/fake'
Version data entries
7 entries across 7 versions & 1 rubygems