custom_emails 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cf7db0fb0e07a50a467b5b7f728ccc28649bb2fa
4
+ data.tar.gz: f993ce6df4d7c416ce6b2d2b9b3fbfaf237f14a0
5
+ SHA512:
6
+ metadata.gz: 4789b60304027a849e6eb4ed1d5a400975d9717941d37fe90f449ee9d97959f734ee253c0cde75111bb0d49886cccd9076956aaca5f84275de88d034a74a71c1
7
+ data.tar.gz: 6a0263461c51eac73dcddd6bf424d75e13416d1db30cb38b45165597a301d2e79a2d7e20670da14febe038e93eb4556827c49eb1d7f331ce928140bf14eb398b
@@ -1,7 +1,7 @@
1
- require 'liquid'
2
-
3
1
  module CustomEmails
4
2
  class Email < ActiveRecord::Base
3
+ include Templatable
4
+
5
5
  if CustomEmails.scoped
6
6
  belongs_to :emailable, polymorphic: true
7
7
  end
@@ -18,35 +18,11 @@ module CustomEmails
18
18
 
19
19
  # Create an interpolated version of some attributes
20
20
  %w(subject content_text content_html).each do |attr|
21
- class_eval "def interpolated_#{attr}(context) ; interpolate(#{attr}, context) end"
22
- end
23
-
24
- # Checks if a content is valid for interpolation.
25
- #
26
- # @return [Boolean]
27
- def self.valid_template?(content)
28
- return true if content.blank?
29
-
30
- template = ::Liquid::Template.parse(content)
31
- template.errors.empty?
21
+ class_eval "def interpolated_#{attr}(context) ; self.class.interpolate(#{attr}, context) end"
32
22
  end
33
23
 
34
24
  private
35
25
 
36
- # Use liquid to get the result of template interpretation.
37
- #
38
- # @param [String] the template
39
- # @param [Hash] the variable tree that have to be inserted into the template
40
- # @retrun [String]
41
- def interpolate(content, context)
42
- template = ::Liquid::Template.parse(content)
43
- if template.errors.empty?
44
- template.render(context)
45
- else
46
- content
47
- end
48
- end
49
-
50
26
  def ensure_valid_templates
51
27
  if content_text.present? && !self.class.valid_template?(content_text)
52
28
  errors.add(:content_text, 'errors are found in the content_text template')
@@ -0,0 +1,27 @@
1
+ module CustomEmails
2
+ class ShortMessage < ActiveRecord::Base
3
+ include Templatable
4
+
5
+ if CustomEmails.scoped_sms
6
+ belongs_to :messageable, polymorphic: true
7
+ end
8
+
9
+ belongs_to :kind, class_name: ShortMessageKind, inverse_of: :short_messages
10
+
11
+ validates_presence_of :locale, :content, :kind
12
+ validate :ensure_valid_templates
13
+
14
+ # Create an interpolated version of some attributes
15
+ %w(content).each do |attr|
16
+ class_eval "def interpolated_#{attr}(context) ; self.class.interpolate(#{attr}, context) end"
17
+ end
18
+
19
+ private
20
+
21
+ def ensure_valid_templates
22
+ if content.present? && !self.class.valid_template?(content)
23
+ errors.add(:content, 'errors are found in the content template')
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,8 @@
1
+ module CustomEmails
2
+ class ShortMessageKind < ActiveRecord::Base
3
+ validates_presence_of :name
4
+ validates_uniqueness_of :name
5
+
6
+ has_many :short_messages, foreign_key: :kind_id, inverse_of: :kind, dependent: :destroy
7
+ end
8
+ end
@@ -0,0 +1,20 @@
1
+ class CreateCustomEmailsShortMessages < ActiveRecord::Migration
2
+ def change
3
+ create_table :custom_emails_short_messages do |t|
4
+ t.integer :messageable_id
5
+ t.string :messageable_type
6
+ t.integer :kind_id
7
+ t.string :locale
8
+ t.text :content
9
+
10
+ t.timestamps
11
+ end
12
+
13
+ add_index :custom_emails_short_messages, :locale
14
+ add_index :custom_emails_short_messages, :messageable_id
15
+ add_index :custom_emails_short_messages, [:kind_id, :messageable_id], name: 'index_w_kind_and_messageable'
16
+
17
+ # The uniqueness of the (kind, locale, messageable) tuple is ensured here
18
+ add_index :custom_emails_short_messages, [:kind_id, :locale, :messageable_id, :messageable_type], unique: true, name: 'unique_w_kind_locale_and_messageable'
19
+ end
20
+ end
@@ -0,0 +1,11 @@
1
+ class CreateCustomEmailsShortMessageKinds < ActiveRecord::Migration
2
+ def change
3
+ create_table :custom_emails_short_message_kinds do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+
9
+ add_index :custom_emails_short_message_kinds, :name, unique: true
10
+ end
11
+ end
@@ -2,11 +2,14 @@ require 'custom_emails/engine'
2
2
 
3
3
  module CustomEmails
4
4
  @@scoped = true
5
+ @@scoped_sms = true
5
6
  @@default_locale = :en
6
7
 
7
8
  mattr_accessor :default_locale
8
9
  mattr_accessor :default_from
9
10
  mattr_accessor :scoped
11
+ mattr_accessor :scoped_sms
10
12
 
11
13
  autoload :Models, 'custom_emails/models'
14
+ autoload :Templatable, 'custom_emails/templatable'
12
15
  end
@@ -13,5 +13,19 @@ module CustomEmails
13
13
  assoc.group_by(&:kind)
14
14
  end"
15
15
  end
16
+
17
+ def has_custom_short_messages(options={})
18
+ options = options.reverse_merge({
19
+ as: :short_messages
20
+ })
21
+
22
+ has_many options[:as], as: :messageable, class_name: ::CustomEmails::ShortMessage, dependent: :destroy
23
+
24
+ class_eval "def #{options[:as]}_by_kind(locale=nil)
25
+ assoc = #{options[:as]}.includes(:kind)
26
+ assoc = assoc.where(locale: locale) if locale
27
+ assoc.group_by(&:kind)
28
+ end"
29
+ end
16
30
  end
17
31
  end
@@ -0,0 +1,34 @@
1
+ require 'active_support/concern'
2
+ require 'liquid'
3
+
4
+ module CustomEmails
5
+ module Templatable
6
+ extend ActiveSupport::Concern
7
+
8
+ module ClassMethods
9
+ # Checks if a content is valid for interpolation.
10
+ #
11
+ # @return [Boolean]
12
+ def valid_template?(content)
13
+ return true if content.blank?
14
+
15
+ template = ::Liquid::Template.parse(content)
16
+ template.errors.empty?
17
+ end
18
+
19
+ # Use liquid to get the result of template interpretation.
20
+ #
21
+ # @param [String] the template
22
+ # @param [Hash] the variable tree that have to be inserted into the template
23
+ # @retrun [String]
24
+ def interpolate(content, context)
25
+ template = ::Liquid::Template.parse(content)
26
+ if template.errors.empty?
27
+ template.render(context)
28
+ else
29
+ content
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,3 +1,3 @@
1
1
  module CustomEmails
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -8,6 +8,7 @@ require 'custom_emails/orm/active_record'
8
8
  # custom_emails with this option. The default is true
9
9
  #
10
10
  #CustomEmails.scoped = false
11
+ #CustomEmails.scoped_sms = false
11
12
 
12
13
  # You can customize the default sender of the custom emails here.
13
14
  # This will be used by CustomEmails::Mailer#custom_email_to
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20131018164626) do
14
+ ActiveRecord::Schema.define(version: 20131224105500) do
15
15
 
16
16
  create_table "custom_emails_email_kinds", force: true do |t|
17
17
  t.string "name"
@@ -38,6 +38,29 @@ ActiveRecord::Schema.define(version: 20131018164626) do
38
38
  add_index "custom_emails_emails", ["kind_id", "locale", "emailable_id", "emailable_type"], name: "unique_w_kind_locale_and_emailable", unique: true
39
39
  add_index "custom_emails_emails", ["locale"], name: "index_custom_emails_emails_on_locale"
40
40
 
41
+ create_table "custom_emails_short_message_kinds", force: true do |t|
42
+ t.string "name"
43
+ t.datetime "created_at"
44
+ t.datetime "updated_at"
45
+ end
46
+
47
+ add_index "custom_emails_short_message_kinds", ["name"], name: "index_custom_emails_short_message_kinds_on_name", unique: true
48
+
49
+ create_table "custom_emails_short_messages", force: true do |t|
50
+ t.integer "messageable_id"
51
+ t.string "messageable_type"
52
+ t.integer "kind_id"
53
+ t.string "locale"
54
+ t.text "content"
55
+ t.datetime "created_at"
56
+ t.datetime "updated_at"
57
+ end
58
+
59
+ add_index "custom_emails_short_messages", ["kind_id", "locale", "messageable_id", "messageable_type"], name: "unique_w_kind_locale_and_messageable", unique: true
60
+ add_index "custom_emails_short_messages", ["kind_id", "messageable_id"], name: "index_w_kind_and_messageable"
61
+ add_index "custom_emails_short_messages", ["locale"], name: "index_custom_emails_short_messages_on_locale"
62
+ add_index "custom_emails_short_messages", ["messageable_id"], name: "index_custom_emails_short_messages_on_messageable_id"
63
+
41
64
  create_table "examples", force: true do |t|
42
65
  end
43
66
 
Binary file
@@ -1199,3 +1199,1136 @@ Migrating to CreateExamples (20131018164626)
1199
1199
  SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131018164626"]]
1200
1200
   (82.0ms) commit transaction
1201
1201
  ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1202
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1203
+ Migrating to CreateCustomEmailsShortMessages (20131224105400)
1204
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1205
+ Migrating to CreateCustomEmailsShortMessages (20131224105400)
1206
+  (0.1ms) begin transaction
1207
+  (19.5ms) CREATE TABLE "custom_emails_short_messages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "messageable_id" integer, "messageable_type" varchar(255), "kind_id" integer, "locale" varchar(255), "content" text, "created_at" datetime, "updated_at" datetime) 
1208
+  (0.1ms) CREATE INDEX "index_custom_emails_short_messages_on_locale" ON "custom_emails_short_messages" ("locale")
1209
+  (0.1ms) CREATE INDEX "index_custom_emails_short_messages_on_messageable_id" ON "custom_emails_short_messages" ("messageable_id")
1210
+  (0.5ms) CREATE INDEX "index_custom_emails_short_messages_on_kind_id_and_emailable_id" ON "custom_emails_short_messages" ("kind_id", "emailable_id")
1211
+ SQLite3::SQLException: table custom_emails_short_messages has no column named emailable_id: CREATE INDEX "index_custom_emails_short_messages_on_kind_id_and_emailable_id" ON "custom_emails_short_messages" ("kind_id", "emailable_id")
1212
+  (0.1ms) rollback transaction
1213
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1214
+ Migrating to CreateCustomEmailsShortMessages (20131224105400)
1215
+  (0.1ms) begin transaction
1216
+  (0.2ms) CREATE TABLE "custom_emails_short_messages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "messageable_id" integer, "messageable_type" varchar(255), "kind_id" integer, "locale" varchar(255), "content" text, "created_at" datetime, "updated_at" datetime) 
1217
+  (0.1ms) CREATE INDEX "index_custom_emails_short_messages_on_locale" ON "custom_emails_short_messages" ("locale")
1218
+  (0.1ms) CREATE INDEX "index_custom_emails_short_messages_on_messageable_id" ON "custom_emails_short_messages" ("messageable_id")
1219
+  (0.1ms) rollback transaction
1220
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1221
+ Migrating to CreateCustomEmailsShortMessages (20131224105400)
1222
+  (0.1ms) begin transaction
1223
+  (0.2ms) CREATE TABLE "custom_emails_short_messages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "messageable_id" integer, "messageable_type" varchar(255), "kind_id" integer, "locale" varchar(255), "content" text, "created_at" datetime, "updated_at" datetime) 
1224
+  (0.1ms) CREATE INDEX "index_custom_emails_short_messages_on_locale" ON "custom_emails_short_messages" ("locale")
1225
+  (0.1ms) CREATE INDEX "index_custom_emails_short_messages_on_messageable_id" ON "custom_emails_short_messages" ("messageable_id")
1226
+  (0.1ms) CREATE INDEX "index_w_kind_and_messageable" ON "custom_emails_short_messages" ("kind_id", "messageable_id")
1227
+  (0.2ms) CREATE UNIQUE INDEX "unique_w_kind_locale_and_messageable" ON "custom_emails_short_messages" ("kind_id", "locale", "messageable_id", "messageable_type")
1228
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131224105400"]]
1229
+  (76.5ms) commit transaction
1230
+ Migrating to CreateCustomEmailsShortMessageKinds (20131224105500)
1231
+  (0.1ms) begin transaction
1232
+  (0.4ms) CREATE TABLE "custom_emails_short_message_kinds" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime) 
1233
+  (0.3ms) CREATE UNIQUE INDEX "index_custom_emails_short_message_kinds_on_name" ON "custom_emails_short_message_kinds" ("name")
1234
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131224105500"]]
1235
+  (89.5ms) commit transaction
1236
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1237
+  (85.0ms) CREATE TABLE "custom_emails_email_kinds" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime) 
1238
+  (77.4ms) CREATE UNIQUE INDEX "index_custom_emails_email_kinds_on_name" ON "custom_emails_email_kinds" ("name")
1239
+  (142.7ms) CREATE TABLE "custom_emails_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "emailable_id" integer, "emailable_type" varchar(255), "locale" varchar(255), "subject" text, "content_text" text, "content_html" text, "created_at" datetime, "updated_at" datetime, "kind_id" integer) 
1240
+  (51.4ms) CREATE INDEX "index_custom_emails_emails_on_emailable_id" ON "custom_emails_emails" ("emailable_id")
1241
+  (51.3ms) CREATE INDEX "index_custom_emails_emails_on_kind_id_and_emailable_id" ON "custom_emails_emails" ("kind_id", "emailable_id")
1242
+  (51.0ms) CREATE UNIQUE INDEX "unique_w_kind_locale_and_emailable" ON "custom_emails_emails" ("kind_id", "locale", "emailable_id", "emailable_type")
1243
+  (126.6ms) CREATE INDEX "index_custom_emails_emails_on_locale" ON "custom_emails_emails" ("locale")
1244
+  (50.8ms) CREATE TABLE "custom_emails_short_message_kinds" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime)
1245
+  (51.7ms) CREATE UNIQUE INDEX "index_custom_emails_short_message_kinds_on_name" ON "custom_emails_short_message_kinds" ("name")
1246
+  (50.8ms) CREATE TABLE "custom_emails_short_messages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "messageable_id" integer, "messageable_type" varchar(255), "kind_id" integer, "locale" varchar(255), "content" text, "created_at" datetime, "updated_at" datetime)
1247
+  (119.2ms) CREATE UNIQUE INDEX "unique_w_kind_locale_and_messageable" ON "custom_emails_short_messages" ("kind_id", "locale", "messageable_id", "messageable_type")
1248
+  (51.6ms) CREATE INDEX "index_w_kind_and_messageable" ON "custom_emails_short_messages" ("kind_id", "messageable_id")
1249
+  (51.0ms) CREATE INDEX "index_custom_emails_short_messages_on_locale" ON "custom_emails_short_messages" ("locale")
1250
+  (59.2ms) CREATE INDEX "index_custom_emails_short_messages_on_messageable_id" ON "custom_emails_short_messages" ("messageable_id")
1251
+  (127.1ms) CREATE TABLE "examples" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) 
1252
+  (49.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
1253
+  (51.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1254
+  (0.2ms) SELECT version FROM "schema_migrations"
1255
+  (50.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20131224105500')
1256
+  (102.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20131018164626')
1257
+  (51.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20131224105400')
1258
+  (51.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20131018143726')
1259
+  (51.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20131018141445')
1260
+  (0.1ms) begin transaction
1261
+ ----------------------------------------------------------------------------------
1262
+ CustomEmails::EmailTest: test_email_has_a_#to_method_that_produces_a_Mail::Message
1263
+ ----------------------------------------------------------------------------------
1264
+
1265
+ Sent mail to foo@bar.org (19.0ms)
1266
+ Date: Tue, 24 Dec 2013 12:17:32 +0100
1267
+ From: sender@example.org
1268
+ To: foo@bar.org
1269
+ Message-ID: <52b96d4c57174_34a23f8dce25be80187d7@chocapic.mail>
1270
+ Subject:
1271
+ Mime-Version: 1.0
1272
+ Content-Type: text/plain;
1273
+ charset=UTF-8
1274
+ Content-Transfer-Encoding: 7bit
1275
+
1276
+
1277
+  (0.1ms) rollback transaction
1278
+  (0.1ms) begin transaction
1279
+ ----------------------------------------------------------------------------------------------------------
1280
+ CustomEmails::EmailTest: test_email_has_interpolation_via_liquid_on_subject,_content_text_and_content_html
1281
+ ----------------------------------------------------------------------------------------------------------
1282
+  (0.1ms) rollback transaction
1283
+  (0.1ms) begin transaction
1284
+ -------------------------------------------------------------------
1285
+ CustomEmails::EmailTest: test_email_is_scoped_to_an_emailable_model
1286
+ -------------------------------------------------------------------
1287
+  (0.1ms) rollback transaction
1288
+  (0.1ms) begin transaction
1289
+ --------------------------------------------------------------------------------------------
1290
+ CustomEmails::EmailTest: test_email_needs_kind,_locale,_subject_and_content_text_to_be_valid
1291
+ --------------------------------------------------------------------------------------------
1292
+  (0.1ms) rollback transaction
1293
+  (0.0ms) begin transaction
1294
+ ------------------------------------------------------------------------------------------
1295
+ CustomEmails::ShortMessageTest: test_Short_message_has_interpolation_via_liquid_on_content
1296
+ ------------------------------------------------------------------------------------------
1297
+  (0.0ms) rollback transaction
1298
+  (0.0ms) begin transaction
1299
+ ------------------------------------------------------------------------------------
1300
+ CustomEmails::ShortMessageTest: test_short_message_is_scoped_to_an_messageable_model
1301
+ ------------------------------------------------------------------------------------
1302
+  (0.1ms) rollback transaction
1303
+  (0.0ms) begin transaction
1304
+ ---------------------------------------------------------------------------------------------
1305
+ CustomEmails::ShortMessageTest: test_short_message_needs_kind,_locale_and_content_to_be_valid
1306
+ ---------------------------------------------------------------------------------------------
1307
+  (0.0ms) rollback transaction
1308
+  (0.0ms) begin transaction
1309
+ ----------------------------
1310
+ CustomEmailsTest: test_truth
1311
+ ----------------------------
1312
+  (0.0ms) rollback transaction
1313
+  (0.0ms) begin transaction
1314
+ ----------------------------------------------------------------------------------
1315
+ MailerTest: test_custom_email_to_raises_an_exception_if_there_is_no_matching_email
1316
+ ----------------------------------------------------------------------------------
1317
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1318
+  (0.0ms) SAVEPOINT active_record_1
1319
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1320
+ SQL (0.6ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00]]
1321
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1322
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1323
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."kind_id" = 1 AND "custom_emails_emails"."emailable_id" IS NULL AND "custom_emails_emails"."locale" = 'en' LIMIT 1
1324
+  (0.0ms) SAVEPOINT active_record_1
1325
+ SQL (0.3ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content_text", "Good luck..."], ["created_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00], ["kind_id", 1], ["locale", :fr], ["subject", "Hello world!"], ["updated_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00]]
1326
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1327
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1328
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."kind_id" = 1 AND "custom_emails_emails"."emailable_id" IS NULL AND "custom_emails_emails"."locale" = 'en' LIMIT 1
1329
+  (0.1ms) rollback transaction
1330
+  (0.0ms) begin transaction
1331
+ --------------------------------------------------------------------------------------
1332
+ MailerTest: test_email_interpolated_attributes_are_used_when_custom_email_to_is_called
1333
+ --------------------------------------------------------------------------------------
1334
+  (0.0ms) SAVEPOINT active_record_1
1335
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1336
+ SQL (0.1ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00]]
1337
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1338
+  (0.0ms) SAVEPOINT active_record_1
1339
+ SQL (0.1ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content_text", "Good luck {{ name }}..."], ["created_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00], ["kind_id", 1], ["locale", :en], ["subject", "Hello {{ name }}!"], ["updated_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00]]
1340
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1341
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1342
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."kind_id" = 1 AND "custom_emails_emails"."emailable_id" IS NULL AND "custom_emails_emails"."locale" = 'en' LIMIT 1
1343
+
1344
+ Sent mail to test@example.com (3.7ms)
1345
+ Date: Tue, 24 Dec 2013 12:17:32 +0100
1346
+ From: sender@example.org
1347
+ To: test@example.com
1348
+ Message-ID: <52b96d4c69662_34a23f8dce25be8018832@chocapic.mail>
1349
+ Subject: Hello Luc!
1350
+ Mime-Version: 1.0
1351
+ Content-Type: text/plain;
1352
+ charset=UTF-8
1353
+ Content-Transfer-Encoding: 7bit
1354
+
1355
+ Good luck Luc...
1356
+  (0.1ms) rollback transaction
1357
+  (0.2ms) begin transaction
1358
+ -----------------------------------------------------------------------------------
1359
+ ModelsTest: test_models_using_has_custom_emails_ends_with_an_#emails_by_kind_method
1360
+ -----------------------------------------------------------------------------------
1361
+  (0.0ms) rollback transaction
1362
+  (0.0ms) begin transaction
1363
+ -----------------------------------------------------------------------------
1364
+ ModelsTest: test_models_using_has_custom_emails_ends_with_an_:emails_relation
1365
+ -----------------------------------------------------------------------------
1366
+  (0.0ms) rollback transaction
1367
+  (0.0ms) begin transaction
1368
+ --------------------------------------------------------------------------------------------
1369
+ ModelsTest: test_the_#emails_by_kind_method_accepts_an_optional_argument_to_filter_by_locale
1370
+ --------------------------------------------------------------------------------------------
1371
+  (0.0ms) SAVEPOINT active_record_1
1372
+ SQL (0.1ms) INSERT INTO "examples" DEFAULT VALUES
1373
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1374
+  (0.0ms) SAVEPOINT active_record_1
1375
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1376
+ SQL (0.2ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00]]
1377
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1378
+  (0.0ms) SAVEPOINT active_record_1
1379
+ CustomEmails::EmailKind Exists (0.0ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_2' LIMIT 1
1380
+ SQL (0.1ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00], ["name", :kind_2], ["updated_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00]]
1381
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1382
+  (0.1ms) SAVEPOINT active_record_1
1383
+ SQL (0.2ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Fake body"], ["created_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 1], ["locale", :en], ["subject", "Fake subject"], ["updated_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00]]
1384
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1385
+  (0.0ms) SAVEPOINT active_record_1
1386
+ SQL (0.1ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Faux corps 2"], ["created_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 2], ["locale", :fr], ["subject", "Faux subjet 2"], ["updated_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00]]
1387
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1388
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."emailable_id" = ? AND "custom_emails_emails"."emailable_type" = ? AND "custom_emails_emails"."locale" = 'fr' [["emailable_id", 1], ["emailable_type", "Example"]]
1389
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."id" IN (2)
1390
+  (0.1ms) rollback transaction
1391
+  (0.0ms) begin transaction
1392
+ -----------------------------------------------------------
1393
+ ModelsTest: test_the_#emails_by_kind_method_returns_an_Hash
1394
+ -----------------------------------------------------------
1395
+  (0.0ms) rollback transaction
1396
+  (0.0ms) begin transaction
1397
+ -------------------------------------------------------------------------------------
1398
+ ModelsTest: test_the_#emails_by_kind_method_returns_an_Hash_of_emails_grouped_by_kind
1399
+ -------------------------------------------------------------------------------------
1400
+  (0.0ms) SAVEPOINT active_record_1
1401
+ SQL (0.1ms) INSERT INTO "examples" DEFAULT VALUES
1402
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1403
+  (0.0ms) SAVEPOINT active_record_1
1404
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1405
+ SQL (0.2ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00]]
1406
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1407
+  (0.0ms) SAVEPOINT active_record_1
1408
+ CustomEmails::EmailKind Exists (0.0ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_2' LIMIT 1
1409
+ SQL (0.1ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00], ["name", :kind_2], ["updated_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00]]
1410
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1411
+  (0.0ms) SAVEPOINT active_record_1
1412
+ SQL (0.1ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Fake body"], ["created_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 1], ["locale", :en], ["subject", "Fake subject"], ["updated_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00]]
1413
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1414
+  (0.0ms) SAVEPOINT active_record_1
1415
+ SQL (0.1ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Fake body 2"], ["created_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 2], ["locale", :en], ["subject", "Fake subject 2"], ["updated_at", Tue, 24 Dec 2013 11:17:32 UTC +00:00]]
1416
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1417
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."emailable_id" = ? AND "custom_emails_emails"."emailable_type" = ? [["emailable_id", 1], ["emailable_type", "Example"]]
1418
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."id" IN (1, 2)
1419
+  (0.1ms) rollback transaction
1420
+  (83.8ms) CREATE TABLE "custom_emails_email_kinds" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime) 
1421
+  (51.0ms) CREATE UNIQUE INDEX "index_custom_emails_email_kinds_on_name" ON "custom_emails_email_kinds" ("name")
1422
+  (67.6ms) CREATE TABLE "custom_emails_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "emailable_id" integer, "emailable_type" varchar(255), "locale" varchar(255), "subject" text, "content_text" text, "content_html" text, "created_at" datetime, "updated_at" datetime, "kind_id" integer) 
1423
+  (123.7ms) CREATE INDEX "index_custom_emails_emails_on_emailable_id" ON "custom_emails_emails" ("emailable_id")
1424
+  (169.2ms) CREATE INDEX "index_custom_emails_emails_on_kind_id_and_emailable_id" ON "custom_emails_emails" ("kind_id", "emailable_id")
1425
+  (50.8ms) CREATE UNIQUE INDEX "unique_w_kind_locale_and_emailable" ON "custom_emails_emails" ("kind_id", "locale", "emailable_id", "emailable_type")
1426
+  (50.9ms) CREATE INDEX "index_custom_emails_emails_on_locale" ON "custom_emails_emails" ("locale")
1427
+  (50.9ms) CREATE TABLE "custom_emails_short_message_kinds" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime)
1428
+  (119.3ms) CREATE UNIQUE INDEX "index_custom_emails_short_message_kinds_on_name" ON "custom_emails_short_message_kinds" ("name")
1429
+  (51.1ms) CREATE TABLE "custom_emails_short_messages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "messageable_id" integer, "messageable_type" varchar(255), "kind_id" integer, "locale" varchar(255), "content" text, "created_at" datetime, "updated_at" datetime)
1430
+  (51.5ms) CREATE UNIQUE INDEX "unique_w_kind_locale_and_messageable" ON "custom_emails_short_messages" ("kind_id", "locale", "messageable_id", "messageable_type")
1431
+  (68.3ms) CREATE INDEX "index_w_kind_and_messageable" ON "custom_emails_short_messages" ("kind_id", "messageable_id")
1432
+  (126.5ms) CREATE INDEX "index_custom_emails_short_messages_on_locale" ON "custom_emails_short_messages" ("locale")
1433
+  (60.1ms) CREATE INDEX "index_custom_emails_short_messages_on_messageable_id" ON "custom_emails_short_messages" ("messageable_id")
1434
+  (51.5ms) CREATE TABLE "examples" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) 
1435
+  (169.5ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
1436
+  (57.3ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1437
+  (0.1ms) SELECT version FROM "schema_migrations"
1438
+  (51.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20131224105500')
1439
+  (52.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20131018164626')
1440
+  (127.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20131224105400')
1441
+  (51.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20131018143726')
1442
+  (51.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20131018141445')
1443
+  (0.1ms) begin transaction
1444
+ ----------------------------------------------------------------------------------
1445
+ CustomEmails::EmailTest: test_email_has_a_#to_method_that_produces_a_Mail::Message
1446
+ ----------------------------------------------------------------------------------
1447
+
1448
+ Sent mail to foo@bar.org (5.4ms)
1449
+ Date: Tue, 24 Dec 2013 12:19:01 +0100
1450
+ From: sender@example.org
1451
+ To: foo@bar.org
1452
+ Message-ID: <52b96da583002_35193ff5b921be7c82314@chocapic.mail>
1453
+ Subject:
1454
+ Mime-Version: 1.0
1455
+ Content-Type: text/plain;
1456
+ charset=UTF-8
1457
+ Content-Transfer-Encoding: 7bit
1458
+
1459
+
1460
+  (0.1ms) rollback transaction
1461
+  (0.0ms) begin transaction
1462
+ ----------------------------------------------------------------------------------------------------------
1463
+ CustomEmails::EmailTest: test_email_has_interpolation_via_liquid_on_subject,_content_text_and_content_html
1464
+ ----------------------------------------------------------------------------------------------------------
1465
+  (0.0ms) rollback transaction
1466
+  (0.0ms) begin transaction
1467
+ -------------------------------------------------------------------
1468
+ CustomEmails::EmailTest: test_email_is_scoped_to_an_emailable_model
1469
+ -------------------------------------------------------------------
1470
+  (0.0ms) rollback transaction
1471
+  (0.0ms) begin transaction
1472
+ --------------------------------------------------------------------------------------------
1473
+ CustomEmails::EmailTest: test_email_needs_kind,_locale,_subject_and_content_text_to_be_valid
1474
+ --------------------------------------------------------------------------------------------
1475
+  (0.1ms) rollback transaction
1476
+  (0.0ms) begin transaction
1477
+ ------------------------------------------------------------------------------------------
1478
+ CustomEmails::ShortMessageTest: test_Short_message_has_interpolation_via_liquid_on_content
1479
+ ------------------------------------------------------------------------------------------
1480
+  (0.0ms) rollback transaction
1481
+  (0.0ms) begin transaction
1482
+ ------------------------------------------------------------------------------------
1483
+ CustomEmails::ShortMessageTest: test_short_message_is_scoped_to_an_messageable_model
1484
+ ------------------------------------------------------------------------------------
1485
+  (0.1ms) rollback transaction
1486
+  (0.0ms) begin transaction
1487
+ ---------------------------------------------------------------------------------------------
1488
+ CustomEmails::ShortMessageTest: test_short_message_needs_kind,_locale_and_content_to_be_valid
1489
+ ---------------------------------------------------------------------------------------------
1490
+  (0.0ms) rollback transaction
1491
+  (0.0ms) begin transaction
1492
+ ----------------------------
1493
+ CustomEmailsTest: test_truth
1494
+ ----------------------------
1495
+  (0.0ms) rollback transaction
1496
+  (0.0ms) begin transaction
1497
+ ----------------------------------------------------------------------------------
1498
+ MailerTest: test_custom_email_to_raises_an_exception_if_there_is_no_matching_email
1499
+ ----------------------------------------------------------------------------------
1500
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1501
+  (0.0ms) SAVEPOINT active_record_1
1502
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1503
+ SQL (0.6ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00]]
1504
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1505
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1506
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."kind_id" = 1 AND "custom_emails_emails"."emailable_id" IS NULL AND "custom_emails_emails"."locale" = 'en' LIMIT 1
1507
+  (0.0ms) SAVEPOINT active_record_1
1508
+ SQL (0.2ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content_text", "Good luck..."], ["created_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00], ["kind_id", 1], ["locale", :fr], ["subject", "Hello world!"], ["updated_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00]]
1509
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1510
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1511
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."kind_id" = 1 AND "custom_emails_emails"."emailable_id" IS NULL AND "custom_emails_emails"."locale" = 'en' LIMIT 1
1512
+  (0.1ms) rollback transaction
1513
+  (0.0ms) begin transaction
1514
+ --------------------------------------------------------------------------------------
1515
+ MailerTest: test_email_interpolated_attributes_are_used_when_custom_email_to_is_called
1516
+ --------------------------------------------------------------------------------------
1517
+  (0.0ms) SAVEPOINT active_record_1
1518
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1519
+ SQL (0.1ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00]]
1520
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1521
+  (0.0ms) SAVEPOINT active_record_1
1522
+ SQL (0.1ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content_text", "Good luck {{ name }}..."], ["created_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00], ["kind_id", 1], ["locale", :en], ["subject", "Hello {{ name }}!"], ["updated_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00]]
1523
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1524
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1525
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."kind_id" = 1 AND "custom_emails_emails"."emailable_id" IS NULL AND "custom_emails_emails"."locale" = 'en' LIMIT 1
1526
+
1527
+ Sent mail to test@example.com (3.7ms)
1528
+ Date: Tue, 24 Dec 2013 12:19:01 +0100
1529
+ From: sender@example.org
1530
+ To: test@example.com
1531
+ Message-ID: <52b96da58fa91_35193ff5b921be7c824c0@chocapic.mail>
1532
+ Subject: Hello Luc!
1533
+ Mime-Version: 1.0
1534
+ Content-Type: text/plain;
1535
+ charset=UTF-8
1536
+ Content-Transfer-Encoding: 7bit
1537
+
1538
+ Good luck Luc...
1539
+  (0.1ms) rollback transaction
1540
+  (0.2ms) begin transaction
1541
+ -----------------------------------------------------------------------------------
1542
+ ModelsTest: test_models_using_has_custom_emails_ends_with_an_#emails_by_kind_method
1543
+ -----------------------------------------------------------------------------------
1544
+  (0.0ms) rollback transaction
1545
+  (0.0ms) begin transaction
1546
+ -----------------------------------------------------------------------------
1547
+ ModelsTest: test_models_using_has_custom_emails_ends_with_an_:emails_relation
1548
+ -----------------------------------------------------------------------------
1549
+  (0.0ms) rollback transaction
1550
+  (0.0ms) begin transaction
1551
+ --------------------------------------------------------------------------------------------
1552
+ ModelsTest: test_the_#emails_by_kind_method_accepts_an_optional_argument_to_filter_by_locale
1553
+ --------------------------------------------------------------------------------------------
1554
+  (0.0ms) SAVEPOINT active_record_1
1555
+ SQL (0.1ms) INSERT INTO "examples" DEFAULT VALUES
1556
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1557
+  (0.0ms) SAVEPOINT active_record_1
1558
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1559
+ SQL (0.2ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00]]
1560
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1561
+  (0.0ms) SAVEPOINT active_record_1
1562
+ CustomEmails::EmailKind Exists (0.0ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_2' LIMIT 1
1563
+ SQL (0.1ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00], ["name", :kind_2], ["updated_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00]]
1564
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1565
+  (0.1ms) SAVEPOINT active_record_1
1566
+ SQL (0.2ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Fake body"], ["created_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 1], ["locale", :en], ["subject", "Fake subject"], ["updated_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00]]
1567
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1568
+  (0.0ms) SAVEPOINT active_record_1
1569
+ SQL (0.1ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Faux corps 2"], ["created_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 2], ["locale", :fr], ["subject", "Faux subjet 2"], ["updated_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00]]
1570
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1571
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."emailable_id" = ? AND "custom_emails_emails"."emailable_type" = ? AND "custom_emails_emails"."locale" = 'fr' [["emailable_id", 1], ["emailable_type", "Example"]]
1572
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."id" IN (2)
1573
+  (0.1ms) rollback transaction
1574
+  (0.0ms) begin transaction
1575
+ -----------------------------------------------------------
1576
+ ModelsTest: test_the_#emails_by_kind_method_returns_an_Hash
1577
+ -----------------------------------------------------------
1578
+  (0.0ms) rollback transaction
1579
+  (0.0ms) begin transaction
1580
+ -------------------------------------------------------------------------------------
1581
+ ModelsTest: test_the_#emails_by_kind_method_returns_an_Hash_of_emails_grouped_by_kind
1582
+ -------------------------------------------------------------------------------------
1583
+  (0.0ms) SAVEPOINT active_record_1
1584
+ SQL (0.1ms) INSERT INTO "examples" DEFAULT VALUES
1585
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1586
+  (0.0ms) SAVEPOINT active_record_1
1587
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1588
+ SQL (0.2ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00]]
1589
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1590
+  (0.0ms) SAVEPOINT active_record_1
1591
+ CustomEmails::EmailKind Exists (0.0ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_2' LIMIT 1
1592
+ SQL (0.1ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00], ["name", :kind_2], ["updated_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00]]
1593
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1594
+  (0.0ms) SAVEPOINT active_record_1
1595
+ SQL (0.1ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Fake body"], ["created_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 1], ["locale", :en], ["subject", "Fake subject"], ["updated_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00]]
1596
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1597
+  (0.0ms) SAVEPOINT active_record_1
1598
+ SQL (0.1ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Fake body 2"], ["created_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 2], ["locale", :en], ["subject", "Fake subject 2"], ["updated_at", Tue, 24 Dec 2013 11:19:01 UTC +00:00]]
1599
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1600
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."emailable_id" = ? AND "custom_emails_emails"."emailable_type" = ? [["emailable_id", 1], ["emailable_type", "Example"]]
1601
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."id" IN (1, 2)
1602
+  (0.1ms) rollback transaction
1603
+  (78.0ms) CREATE TABLE "custom_emails_email_kinds" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime) 
1604
+  (51.3ms) CREATE UNIQUE INDEX "index_custom_emails_email_kinds_on_name" ON "custom_emails_email_kinds" ("name")
1605
+  (51.2ms) CREATE TABLE "custom_emails_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "emailable_id" integer, "emailable_type" varchar(255), "locale" varchar(255), "subject" text, "content_text" text, "content_html" text, "created_at" datetime, "updated_at" datetime, "kind_id" integer) 
1606
+  (135.2ms) CREATE INDEX "index_custom_emails_emails_on_emailable_id" ON "custom_emails_emails" ("emailable_id")
1607
+  (51.3ms) CREATE INDEX "index_custom_emails_emails_on_kind_id_and_emailable_id" ON "custom_emails_emails" ("kind_id", "emailable_id")
1608
+  (50.9ms) CREATE UNIQUE INDEX "unique_w_kind_locale_and_emailable" ON "custom_emails_emails" ("kind_id", "locale", "emailable_id", "emailable_type")
1609
+  (59.3ms) CREATE INDEX "index_custom_emails_emails_on_locale" ON "custom_emails_emails" ("locale")
1610
+  (135.2ms) CREATE TABLE "custom_emails_short_message_kinds" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime)
1611
+  (51.6ms) CREATE UNIQUE INDEX "index_custom_emails_short_message_kinds_on_name" ON "custom_emails_short_message_kinds" ("name")
1612
+  (50.8ms) CREATE TABLE "custom_emails_short_messages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "messageable_id" integer, "messageable_type" varchar(255), "kind_id" integer, "locale" varchar(255), "content" text, "created_at" datetime, "updated_at" datetime)
1613
+  (59.7ms) CREATE UNIQUE INDEX "unique_w_kind_locale_and_messageable" ON "custom_emails_short_messages" ("kind_id", "locale", "messageable_id", "messageable_type")
1614
+  (127.5ms) CREATE INDEX "index_w_kind_and_messageable" ON "custom_emails_short_messages" ("kind_id", "messageable_id")
1615
+  (51.2ms) CREATE INDEX "index_custom_emails_short_messages_on_locale" ON "custom_emails_short_messages" ("locale")
1616
+  (50.8ms) CREATE INDEX "index_custom_emails_short_messages_on_messageable_id" ON "custom_emails_short_messages" ("messageable_id")
1617
+  (144.0ms) CREATE TABLE "examples" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) 
1618
+  (100.5ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
1619
+  (51.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1620
+  (0.1ms) SELECT version FROM "schema_migrations"
1621
+  (51.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20131224105500')
1622
+  (127.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20131018164626')
1623
+  (51.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20131224105400')
1624
+  (51.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20131018143726')
1625
+  (51.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20131018141445')
1626
+  (0.1ms) begin transaction
1627
+ ----------------------------------------------------------------------------------
1628
+ CustomEmails::EmailTest: test_email_has_a_#to_method_that_produces_a_Mail::Message
1629
+ ----------------------------------------------------------------------------------
1630
+
1631
+ Sent mail to foo@bar.org (5.4ms)
1632
+ Date: Tue, 24 Dec 2013 12:20:15 +0100
1633
+ From: sender@example.org
1634
+ To: foo@bar.org
1635
+ Message-ID: <52b96def763d8_35753ff7c77abe7c24933@chocapic.mail>
1636
+ Subject:
1637
+ Mime-Version: 1.0
1638
+ Content-Type: text/plain;
1639
+ charset=UTF-8
1640
+ Content-Transfer-Encoding: 7bit
1641
+
1642
+
1643
+  (0.1ms) rollback transaction
1644
+  (0.1ms) begin transaction
1645
+ ----------------------------------------------------------------------------------------------------------
1646
+ CustomEmails::EmailTest: test_email_has_interpolation_via_liquid_on_subject,_content_text_and_content_html
1647
+ ----------------------------------------------------------------------------------------------------------
1648
+  (0.0ms) rollback transaction
1649
+  (0.0ms) begin transaction
1650
+ -------------------------------------------------------------------
1651
+ CustomEmails::EmailTest: test_email_is_scoped_to_an_emailable_model
1652
+ -------------------------------------------------------------------
1653
+  (0.0ms) rollback transaction
1654
+  (0.0ms) begin transaction
1655
+ --------------------------------------------------------------------------------------------
1656
+ CustomEmails::EmailTest: test_email_needs_kind,_locale,_subject_and_content_text_to_be_valid
1657
+ --------------------------------------------------------------------------------------------
1658
+  (0.1ms) rollback transaction
1659
+  (0.0ms) begin transaction
1660
+ ------------------------------------------------------------------------------------------
1661
+ CustomEmails::ShortMessageTest: test_Short_message_has_interpolation_via_liquid_on_content
1662
+ ------------------------------------------------------------------------------------------
1663
+  (0.0ms) rollback transaction
1664
+  (0.0ms) begin transaction
1665
+ ------------------------------------------------------------------------------------
1666
+ CustomEmails::ShortMessageTest: test_short_message_is_scoped_to_an_messageable_model
1667
+ ------------------------------------------------------------------------------------
1668
+  (0.1ms) rollback transaction
1669
+  (0.0ms) begin transaction
1670
+ ---------------------------------------------------------------------------------------------
1671
+ CustomEmails::ShortMessageTest: test_short_message_needs_kind,_locale_and_content_to_be_valid
1672
+ ---------------------------------------------------------------------------------------------
1673
+  (0.1ms) rollback transaction
1674
+  (0.0ms) begin transaction
1675
+ ----------------------------
1676
+ CustomEmailsTest: test_truth
1677
+ ----------------------------
1678
+  (0.0ms) rollback transaction
1679
+  (0.0ms) begin transaction
1680
+ ----------------------------------------------------------------------------------
1681
+ MailerTest: test_custom_email_to_raises_an_exception_if_there_is_no_matching_email
1682
+ ----------------------------------------------------------------------------------
1683
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1684
+  (0.0ms) SAVEPOINT active_record_1
1685
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1686
+ SQL (0.6ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00]]
1687
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1688
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1689
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."kind_id" = 1 AND "custom_emails_emails"."emailable_id" IS NULL AND "custom_emails_emails"."locale" = 'en' LIMIT 1
1690
+  (0.0ms) SAVEPOINT active_record_1
1691
+ SQL (0.3ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content_text", "Good luck..."], ["created_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00], ["kind_id", 1], ["locale", :fr], ["subject", "Hello world!"], ["updated_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00]]
1692
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1693
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1694
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."kind_id" = 1 AND "custom_emails_emails"."emailable_id" IS NULL AND "custom_emails_emails"."locale" = 'en' LIMIT 1
1695
+  (0.1ms) rollback transaction
1696
+  (0.0ms) begin transaction
1697
+ --------------------------------------------------------------------------------------
1698
+ MailerTest: test_email_interpolated_attributes_are_used_when_custom_email_to_is_called
1699
+ --------------------------------------------------------------------------------------
1700
+  (0.0ms) SAVEPOINT active_record_1
1701
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1702
+ SQL (0.1ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00]]
1703
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1704
+  (0.0ms) SAVEPOINT active_record_1
1705
+ SQL (0.2ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content_text", "Good luck {{ name }}..."], ["created_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00], ["kind_id", 1], ["locale", :en], ["subject", "Hello {{ name }}!"], ["updated_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00]]
1706
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1707
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1708
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."kind_id" = 1 AND "custom_emails_emails"."emailable_id" IS NULL AND "custom_emails_emails"."locale" = 'en' LIMIT 1
1709
+
1710
+ Sent mail to test@example.com (3.6ms)
1711
+ Date: Tue, 24 Dec 2013 12:20:15 +0100
1712
+ From: sender@example.org
1713
+ To: test@example.com
1714
+ Message-ID: <52b96def830b7_35753ff7c77abe7c2505c@chocapic.mail>
1715
+ Subject: Hello Luc!
1716
+ Mime-Version: 1.0
1717
+ Content-Type: text/plain;
1718
+ charset=UTF-8
1719
+ Content-Transfer-Encoding: 7bit
1720
+
1721
+ Good luck Luc...
1722
+  (0.1ms) rollback transaction
1723
+  (0.2ms) begin transaction
1724
+ -----------------------------------------------------------------------------------
1725
+ ModelsTest: test_models_using_has_custom_emails_ends_with_an_#emails_by_kind_method
1726
+ -----------------------------------------------------------------------------------
1727
+  (0.0ms) rollback transaction
1728
+  (0.0ms) begin transaction
1729
+ -----------------------------------------------------------------------------
1730
+ ModelsTest: test_models_using_has_custom_emails_ends_with_an_:emails_relation
1731
+ -----------------------------------------------------------------------------
1732
+  (0.0ms) rollback transaction
1733
+  (0.0ms) begin transaction
1734
+ --------------------------------------------------------------------------------------------
1735
+ ModelsTest: test_the_#emails_by_kind_method_accepts_an_optional_argument_to_filter_by_locale
1736
+ --------------------------------------------------------------------------------------------
1737
+  (0.0ms) SAVEPOINT active_record_1
1738
+ SQL (0.1ms) INSERT INTO "examples" DEFAULT VALUES
1739
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1740
+  (0.0ms) SAVEPOINT active_record_1
1741
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1742
+ SQL (0.2ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00]]
1743
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1744
+  (0.0ms) SAVEPOINT active_record_1
1745
+ CustomEmails::EmailKind Exists (0.0ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_2' LIMIT 1
1746
+ SQL (0.1ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00], ["name", :kind_2], ["updated_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00]]
1747
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1748
+  (0.1ms) SAVEPOINT active_record_1
1749
+ SQL (0.2ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Fake body"], ["created_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 1], ["locale", :en], ["subject", "Fake subject"], ["updated_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00]]
1750
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1751
+  (0.0ms) SAVEPOINT active_record_1
1752
+ SQL (0.1ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Faux corps 2"], ["created_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 2], ["locale", :fr], ["subject", "Faux subjet 2"], ["updated_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00]]
1753
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1754
+ CustomEmails::Email Load (0.2ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."emailable_id" = ? AND "custom_emails_emails"."emailable_type" = ? AND "custom_emails_emails"."locale" = 'fr' [["emailable_id", 1], ["emailable_type", "Example"]]
1755
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."id" IN (2)
1756
+  (0.1ms) rollback transaction
1757
+  (0.0ms) begin transaction
1758
+ -----------------------------------------------------------
1759
+ ModelsTest: test_the_#emails_by_kind_method_returns_an_Hash
1760
+ -----------------------------------------------------------
1761
+  (0.0ms) rollback transaction
1762
+  (0.0ms) begin transaction
1763
+ -------------------------------------------------------------------------------------
1764
+ ModelsTest: test_the_#emails_by_kind_method_returns_an_Hash_of_emails_grouped_by_kind
1765
+ -------------------------------------------------------------------------------------
1766
+  (0.0ms) SAVEPOINT active_record_1
1767
+ SQL (0.1ms) INSERT INTO "examples" DEFAULT VALUES
1768
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1769
+  (0.0ms) SAVEPOINT active_record_1
1770
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1771
+ SQL (0.2ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00]]
1772
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1773
+  (0.0ms) SAVEPOINT active_record_1
1774
+ CustomEmails::EmailKind Exists (0.0ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_2' LIMIT 1
1775
+ SQL (0.1ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00], ["name", :kind_2], ["updated_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00]]
1776
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1777
+  (0.0ms) SAVEPOINT active_record_1
1778
+ SQL (0.2ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Fake body"], ["created_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 1], ["locale", :en], ["subject", "Fake subject"], ["updated_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00]]
1779
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1780
+  (0.0ms) SAVEPOINT active_record_1
1781
+ SQL (0.1ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Fake body 2"], ["created_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 2], ["locale", :en], ["subject", "Fake subject 2"], ["updated_at", Tue, 24 Dec 2013 11:20:15 UTC +00:00]]
1782
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1783
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."emailable_id" = ? AND "custom_emails_emails"."emailable_type" = ? [["emailable_id", 1], ["emailable_type", "Example"]]
1784
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."id" IN (1, 2)
1785
+  (0.1ms) rollback transaction
1786
+  (83.0ms) CREATE TABLE "custom_emails_email_kinds" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime) 
1787
+  (51.0ms) CREATE UNIQUE INDEX "index_custom_emails_email_kinds_on_name" ON "custom_emails_email_kinds" ("name")
1788
+  (51.0ms) CREATE TABLE "custom_emails_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "emailable_id" integer, "emailable_type" varchar(255), "locale" varchar(255), "subject" text, "content_text" text, "content_html" text, "created_at" datetime, "updated_at" datetime, "kind_id" integer) 
1789
+  (118.7ms) CREATE INDEX "index_custom_emails_emails_on_emailable_id" ON "custom_emails_emails" ("emailable_id")
1790
+  (51.3ms) CREATE INDEX "index_custom_emails_emails_on_kind_id_and_emailable_id" ON "custom_emails_emails" ("kind_id", "emailable_id")
1791
+  (50.9ms) CREATE UNIQUE INDEX "unique_w_kind_locale_and_emailable" ON "custom_emails_emails" ("kind_id", "locale", "emailable_id", "emailable_type")
1792
+  (50.8ms) CREATE INDEX "index_custom_emails_emails_on_locale" ON "custom_emails_emails" ("locale")
1793
+  (143.3ms) CREATE TABLE "custom_emails_short_message_kinds" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime)
1794
+  (51.6ms) CREATE UNIQUE INDEX "index_custom_emails_short_message_kinds_on_name" ON "custom_emails_short_message_kinds" ("name")
1795
+  (50.7ms) CREATE TABLE "custom_emails_short_messages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "messageable_id" integer, "messageable_type" varchar(255), "kind_id" integer, "locale" varchar(255), "content" text, "created_at" datetime, "updated_at" datetime)
1796
+  (51.4ms) CREATE UNIQUE INDEX "unique_w_kind_locale_and_messageable" ON "custom_emails_short_messages" ("kind_id", "locale", "messageable_id", "messageable_type")
1797
+  (119.3ms) CREATE INDEX "index_w_kind_and_messageable" ON "custom_emails_short_messages" ("kind_id", "messageable_id")
1798
+  (51.1ms) CREATE INDEX "index_custom_emails_short_messages_on_locale" ON "custom_emails_short_messages" ("locale")
1799
+  (50.8ms) CREATE INDEX "index_custom_emails_short_messages_on_messageable_id" ON "custom_emails_short_messages" ("messageable_id")
1800
+  (59.8ms) CREATE TABLE "examples" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) 
1801
+  (125.6ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
1802
+  (51.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1803
+  (0.1ms) SELECT version FROM "schema_migrations"
1804
+  (51.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20131224105500')
1805
+  (51.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20131018164626')
1806
+  (152.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20131224105400')
1807
+  (51.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131018143726')
1808
+  (51.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20131018141445')
1809
+  (0.1ms) begin transaction
1810
+ ----------------------------------------------------------------------------------
1811
+ CustomEmails::EmailTest: test_email_has_a_#to_method_that_produces_a_Mail::Message
1812
+ ----------------------------------------------------------------------------------
1813
+
1814
+ Sent mail to foo@bar.org (5.4ms)
1815
+ Date: Tue, 24 Dec 2013 12:21:12 +0100
1816
+ From: sender@example.org
1817
+ To: foo@bar.org
1818
+ Message-ID: <52b96e2868cb0_35d03fdea069be78580cd@chocapic.mail>
1819
+ Subject:
1820
+ Mime-Version: 1.0
1821
+ Content-Type: text/plain;
1822
+ charset=UTF-8
1823
+ Content-Transfer-Encoding: 7bit
1824
+
1825
+
1826
+  (0.1ms) rollback transaction
1827
+  (0.0ms) begin transaction
1828
+ ----------------------------------------------------------------------------------------------------------
1829
+ CustomEmails::EmailTest: test_email_has_interpolation_via_liquid_on_subject,_content_text_and_content_html
1830
+ ----------------------------------------------------------------------------------------------------------
1831
+  (0.0ms) rollback transaction
1832
+  (0.0ms) begin transaction
1833
+ -------------------------------------------------------------------
1834
+ CustomEmails::EmailTest: test_email_is_scoped_to_an_emailable_model
1835
+ -------------------------------------------------------------------
1836
+  (0.0ms) rollback transaction
1837
+  (0.0ms) begin transaction
1838
+ --------------------------------------------------------------------------------------------
1839
+ CustomEmails::EmailTest: test_email_needs_kind,_locale,_subject_and_content_text_to_be_valid
1840
+ --------------------------------------------------------------------------------------------
1841
+  (0.1ms) rollback transaction
1842
+  (0.0ms) begin transaction
1843
+ ------------------------------------------------------------------------------------------
1844
+ CustomEmails::ShortMessageTest: test_Short_message_has_interpolation_via_liquid_on_content
1845
+ ------------------------------------------------------------------------------------------
1846
+  (0.0ms) rollback transaction
1847
+  (0.0ms) begin transaction
1848
+ ------------------------------------------------------------------------------------
1849
+ CustomEmails::ShortMessageTest: test_short_message_is_scoped_to_an_messageable_model
1850
+ ------------------------------------------------------------------------------------
1851
+  (0.1ms) rollback transaction
1852
+  (0.0ms) begin transaction
1853
+ ---------------------------------------------------------------------------------------------
1854
+ CustomEmails::ShortMessageTest: test_short_message_needs_kind,_locale_and_content_to_be_valid
1855
+ ---------------------------------------------------------------------------------------------
1856
+  (0.1ms) rollback transaction
1857
+  (0.0ms) begin transaction
1858
+ ----------------------------
1859
+ CustomEmailsTest: test_truth
1860
+ ----------------------------
1861
+  (0.0ms) rollback transaction
1862
+  (0.0ms) begin transaction
1863
+ ----------------------------------------------------------------------------------
1864
+ MailerTest: test_custom_email_to_raises_an_exception_if_there_is_no_matching_email
1865
+ ----------------------------------------------------------------------------------
1866
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1867
+  (0.0ms) SAVEPOINT active_record_1
1868
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1869
+ SQL (0.6ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00]]
1870
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1871
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1872
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."kind_id" = 1 AND "custom_emails_emails"."emailable_id" IS NULL AND "custom_emails_emails"."locale" = 'en' LIMIT 1
1873
+  (0.0ms) SAVEPOINT active_record_1
1874
+ SQL (0.2ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content_text", "Good luck..."], ["created_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00], ["kind_id", 1], ["locale", :fr], ["subject", "Hello world!"], ["updated_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00]]
1875
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1876
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1877
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."kind_id" = 1 AND "custom_emails_emails"."emailable_id" IS NULL AND "custom_emails_emails"."locale" = 'en' LIMIT 1
1878
+  (0.1ms) rollback transaction
1879
+  (0.0ms) begin transaction
1880
+ --------------------------------------------------------------------------------------
1881
+ MailerTest: test_email_interpolated_attributes_are_used_when_custom_email_to_is_called
1882
+ --------------------------------------------------------------------------------------
1883
+  (0.0ms) SAVEPOINT active_record_1
1884
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1885
+ SQL (0.1ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00]]
1886
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1887
+  (0.0ms) SAVEPOINT active_record_1
1888
+ SQL (0.2ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content_text", "Good luck {{ name }}..."], ["created_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00], ["kind_id", 1], ["locale", :en], ["subject", "Hello {{ name }}!"], ["updated_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00]]
1889
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1890
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1891
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."kind_id" = 1 AND "custom_emails_emails"."emailable_id" IS NULL AND "custom_emails_emails"."locale" = 'en' LIMIT 1
1892
+
1893
+ Sent mail to test@example.com (28.1ms)
1894
+ Date: Tue, 24 Dec 2013 12:21:12 +0100
1895
+ From: sender@example.org
1896
+ To: test@example.com
1897
+ Message-ID: <52b96e2875ba3_35d03fdea069be7858113@chocapic.mail>
1898
+ Subject: Hello Luc!
1899
+ Mime-Version: 1.0
1900
+ Content-Type: text/plain;
1901
+ charset=UTF-8
1902
+ Content-Transfer-Encoding: 7bit
1903
+
1904
+ Good luck Luc...
1905
+  (0.2ms) rollback transaction
1906
+  (0.0ms) begin transaction
1907
+ -----------------------------------------------------------------------------------
1908
+ ModelsTest: test_models_using_has_custom_emails_ends_with_an_#emails_by_kind_method
1909
+ -----------------------------------------------------------------------------------
1910
+  (0.0ms) rollback transaction
1911
+  (0.0ms) begin transaction
1912
+ -----------------------------------------------------------------------------
1913
+ ModelsTest: test_models_using_has_custom_emails_ends_with_an_:emails_relation
1914
+ -----------------------------------------------------------------------------
1915
+  (0.0ms) rollback transaction
1916
+  (0.0ms) begin transaction
1917
+ --------------------------------------------------------------------------------------------
1918
+ ModelsTest: test_the_#emails_by_kind_method_accepts_an_optional_argument_to_filter_by_locale
1919
+ --------------------------------------------------------------------------------------------
1920
+  (0.0ms) SAVEPOINT active_record_1
1921
+ SQL (0.1ms) INSERT INTO "examples" DEFAULT VALUES
1922
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1923
+  (0.0ms) SAVEPOINT active_record_1
1924
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1925
+ SQL (0.2ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00]]
1926
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1927
+  (0.0ms) SAVEPOINT active_record_1
1928
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_2' LIMIT 1
1929
+ SQL (0.1ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00], ["name", :kind_2], ["updated_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00]]
1930
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1931
+  (0.1ms) SAVEPOINT active_record_1
1932
+ SQL (0.2ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Fake body"], ["created_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 1], ["locale", :en], ["subject", "Fake subject"], ["updated_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00]]
1933
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1934
+  (0.0ms) SAVEPOINT active_record_1
1935
+ SQL (0.1ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Faux corps 2"], ["created_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 2], ["locale", :fr], ["subject", "Faux subjet 2"], ["updated_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00]]
1936
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1937
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."emailable_id" = ? AND "custom_emails_emails"."emailable_type" = ? AND "custom_emails_emails"."locale" = 'fr' [["emailable_id", 1], ["emailable_type", "Example"]]
1938
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."id" IN (2)
1939
+  (0.1ms) rollback transaction
1940
+  (0.0ms) begin transaction
1941
+ -----------------------------------------------------------
1942
+ ModelsTest: test_the_#emails_by_kind_method_returns_an_Hash
1943
+ -----------------------------------------------------------
1944
+  (0.0ms) rollback transaction
1945
+  (0.0ms) begin transaction
1946
+ -------------------------------------------------------------------------------------
1947
+ ModelsTest: test_the_#emails_by_kind_method_returns_an_Hash_of_emails_grouped_by_kind
1948
+ -------------------------------------------------------------------------------------
1949
+  (0.0ms) SAVEPOINT active_record_1
1950
+ SQL (0.1ms) INSERT INTO "examples" DEFAULT VALUES
1951
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1952
+  (0.0ms) SAVEPOINT active_record_1
1953
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
1954
+ SQL (0.2ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00]]
1955
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1956
+  (0.0ms) SAVEPOINT active_record_1
1957
+ CustomEmails::EmailKind Exists (0.0ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_2' LIMIT 1
1958
+ SQL (0.1ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00], ["name", :kind_2], ["updated_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00]]
1959
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1960
+  (0.0ms) SAVEPOINT active_record_1
1961
+ SQL (0.1ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Fake body"], ["created_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 1], ["locale", :en], ["subject", "Fake subject"], ["updated_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00]]
1962
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1963
+  (0.0ms) SAVEPOINT active_record_1
1964
+ SQL (0.1ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Fake body 2"], ["created_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 2], ["locale", :en], ["subject", "Fake subject 2"], ["updated_at", Tue, 24 Dec 2013 11:21:12 UTC +00:00]]
1965
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1966
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."emailable_id" = ? AND "custom_emails_emails"."emailable_type" = ? [["emailable_id", 1], ["emailable_type", "Example"]]
1967
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."id" IN (1, 2)
1968
+  (0.1ms) rollback transaction
1969
+  (77.2ms) CREATE TABLE "custom_emails_email_kinds" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime) 
1970
+  (50.9ms) CREATE UNIQUE INDEX "index_custom_emails_email_kinds_on_name" ON "custom_emails_email_kinds" ("name")
1971
+  (125.3ms) CREATE TABLE "custom_emails_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "emailable_id" integer, "emailable_type" varchar(255), "locale" varchar(255), "subject" text, "content_text" text, "content_html" text, "created_at" datetime, "updated_at" datetime, "kind_id" integer) 
1972
+  (60.8ms) CREATE INDEX "index_custom_emails_emails_on_emailable_id" ON "custom_emails_emails" ("emailable_id")
1973
+  (51.3ms) CREATE INDEX "index_custom_emails_emails_on_kind_id_and_emailable_id" ON "custom_emails_emails" ("kind_id", "emailable_id")
1974
+  (50.9ms) CREATE UNIQUE INDEX "unique_w_kind_locale_and_emailable" ON "custom_emails_emails" ("kind_id", "locale", "emailable_id", "emailable_type")
1975
+  (92.5ms) CREATE INDEX "index_custom_emails_emails_on_locale" ON "custom_emails_emails" ("locale")
1976
+  (101.0ms) CREATE TABLE "custom_emails_short_message_kinds" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime)
1977
+  (51.7ms) CREATE UNIQUE INDEX "index_custom_emails_short_message_kinds_on_name" ON "custom_emails_short_message_kinds" ("name")
1978
+  (50.7ms) CREATE TABLE "custom_emails_short_messages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "messageable_id" integer, "messageable_type" varchar(255), "kind_id" integer, "locale" varchar(255), "content" text, "created_at" datetime, "updated_at" datetime)
1979
+  (59.8ms) CREATE UNIQUE INDEX "unique_w_kind_locale_and_messageable" ON "custom_emails_short_messages" ("kind_id", "locale", "messageable_id", "messageable_type")
1980
+  (119.0ms) CREATE INDEX "index_w_kind_and_messageable" ON "custom_emails_short_messages" ("kind_id", "messageable_id")
1981
+  (51.2ms) CREATE INDEX "index_custom_emails_short_messages_on_locale" ON "custom_emails_short_messages" ("locale")
1982
+  (50.8ms) CREATE INDEX "index_custom_emails_short_messages_on_messageable_id" ON "custom_emails_short_messages" ("messageable_id")
1983
+  (68.1ms) CREATE TABLE "examples" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) 
1984
+  (133.6ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
1985
+  (51.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1986
+  (0.1ms) SELECT version FROM "schema_migrations"
1987
+  (51.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20131224105500')
1988
+  (51.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20131018164626')
1989
+  (135.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20131224105400')
1990
+  (51.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20131018143726')
1991
+  (51.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20131018141445')
1992
+  (0.1ms) begin transaction
1993
+ ----------------------------------------------------------------------------------
1994
+ CustomEmails::EmailTest: test_email_has_a_#to_method_that_produces_a_Mail::Message
1995
+ ----------------------------------------------------------------------------------
1996
+
1997
+ Sent mail to foo@bar.org (5.3ms)
1998
+ Date: Tue, 24 Dec 2013 12:21:49 +0100
1999
+ From: sender@example.org
2000
+ To: foo@bar.org
2001
+ Message-ID: <52b96e4d3b956_360d3f8d2e16fe7c765@chocapic.mail>
2002
+ Subject:
2003
+ Mime-Version: 1.0
2004
+ Content-Type: text/plain;
2005
+ charset=UTF-8
2006
+ Content-Transfer-Encoding: 7bit
2007
+
2008
+
2009
+  (0.1ms) rollback transaction
2010
+  (0.1ms) begin transaction
2011
+ ----------------------------------------------------------------------------------------------------------
2012
+ CustomEmails::EmailTest: test_email_has_interpolation_via_liquid_on_subject,_content_text_and_content_html
2013
+ ----------------------------------------------------------------------------------------------------------
2014
+  (0.0ms) rollback transaction
2015
+  (0.0ms) begin transaction
2016
+ -------------------------------------------------------------------
2017
+ CustomEmails::EmailTest: test_email_is_scoped_to_an_emailable_model
2018
+ -------------------------------------------------------------------
2019
+  (0.0ms) rollback transaction
2020
+  (0.0ms) begin transaction
2021
+ --------------------------------------------------------------------------------------------
2022
+ CustomEmails::EmailTest: test_email_needs_kind,_locale,_subject_and_content_text_to_be_valid
2023
+ --------------------------------------------------------------------------------------------
2024
+  (0.1ms) rollback transaction
2025
+  (0.0ms) begin transaction
2026
+ ------------------------------------------------------------------------------------------
2027
+ CustomEmails::ShortMessageTest: test_Short_message_has_interpolation_via_liquid_on_content
2028
+ ------------------------------------------------------------------------------------------
2029
+  (0.1ms) rollback transaction
2030
+  (0.0ms) begin transaction
2031
+ ------------------------------------------------------------------------------------
2032
+ CustomEmails::ShortMessageTest: test_short_message_is_scoped_to_an_messageable_model
2033
+ ------------------------------------------------------------------------------------
2034
+  (0.0ms) rollback transaction
2035
+  (0.0ms) begin transaction
2036
+ ---------------------------------------------------------------------------------------------
2037
+ CustomEmails::ShortMessageTest: test_short_message_needs_kind,_locale_and_content_to_be_valid
2038
+ ---------------------------------------------------------------------------------------------
2039
+  (0.1ms) rollback transaction
2040
+  (0.0ms) begin transaction
2041
+ ----------------------------
2042
+ CustomEmailsTest: test_truth
2043
+ ----------------------------
2044
+  (0.1ms) rollback transaction
2045
+  (0.0ms) begin transaction
2046
+ ----------------------------------------------------------------------------------
2047
+ MailerTest: test_custom_email_to_raises_an_exception_if_there_is_no_matching_email
2048
+ ----------------------------------------------------------------------------------
2049
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
2050
+  (0.1ms) SAVEPOINT active_record_1
2051
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
2052
+ SQL (0.6ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00]]
2053
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2054
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
2055
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."kind_id" = 1 AND "custom_emails_emails"."emailable_id" IS NULL AND "custom_emails_emails"."locale" = 'en' LIMIT 1
2056
+  (0.0ms) SAVEPOINT active_record_1
2057
+ SQL (0.2ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content_text", "Good luck..."], ["created_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00], ["kind_id", 1], ["locale", :fr], ["subject", "Hello world!"], ["updated_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00]]
2058
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2059
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
2060
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."kind_id" = 1 AND "custom_emails_emails"."emailable_id" IS NULL AND "custom_emails_emails"."locale" = 'en' LIMIT 1
2061
+  (0.3ms) rollback transaction
2062
+  (0.0ms) begin transaction
2063
+ --------------------------------------------------------------------------------------
2064
+ MailerTest: test_email_interpolated_attributes_are_used_when_custom_email_to_is_called
2065
+ --------------------------------------------------------------------------------------
2066
+  (0.0ms) SAVEPOINT active_record_1
2067
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
2068
+ SQL (0.2ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00]]
2069
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2070
+  (0.0ms) SAVEPOINT active_record_1
2071
+ SQL (0.2ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content_text", "Good luck {{ name }}..."], ["created_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00], ["kind_id", 1], ["locale", :en], ["subject", "Hello {{ name }}!"], ["updated_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00]]
2072
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2073
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
2074
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."kind_id" = 1 AND "custom_emails_emails"."emailable_id" IS NULL AND "custom_emails_emails"."locale" = 'en' LIMIT 1
2075
+
2076
+ Sent mail to test@example.com (3.7ms)
2077
+ Date: Tue, 24 Dec 2013 12:21:49 +0100
2078
+ From: sender@example.org
2079
+ To: test@example.com
2080
+ Message-ID: <52b96e4d4f223_360d3f8d2e16fe7c89d@chocapic.mail>
2081
+ Subject: Hello Luc!
2082
+ Mime-Version: 1.0
2083
+ Content-Type: text/plain;
2084
+ charset=UTF-8
2085
+ Content-Transfer-Encoding: 7bit
2086
+
2087
+ Good luck Luc...
2088
+  (0.1ms) rollback transaction
2089
+  (0.0ms) begin transaction
2090
+ -----------------------------------------------------------------------------------
2091
+ ModelsTest: test_models_using_has_custom_emails_ends_with_an_#emails_by_kind_method
2092
+ -----------------------------------------------------------------------------------
2093
+  (0.0ms) rollback transaction
2094
+  (0.0ms) begin transaction
2095
+ -----------------------------------------------------------------------------
2096
+ ModelsTest: test_models_using_has_custom_emails_ends_with_an_:emails_relation
2097
+ -----------------------------------------------------------------------------
2098
+  (0.0ms) rollback transaction
2099
+  (0.0ms) begin transaction
2100
+ --------------------------------------------------------------------------------------------
2101
+ ModelsTest: test_the_#emails_by_kind_method_accepts_an_optional_argument_to_filter_by_locale
2102
+ --------------------------------------------------------------------------------------------
2103
+  (0.0ms) SAVEPOINT active_record_1
2104
+ SQL (0.1ms) INSERT INTO "examples" DEFAULT VALUES
2105
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2106
+  (0.0ms) SAVEPOINT active_record_1
2107
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
2108
+ SQL (0.2ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00]]
2109
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2110
+  (0.0ms) SAVEPOINT active_record_1
2111
+ CustomEmails::EmailKind Exists (0.0ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_2' LIMIT 1
2112
+ SQL (0.1ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00], ["name", :kind_2], ["updated_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00]]
2113
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2114
+  (0.1ms) SAVEPOINT active_record_1
2115
+ SQL (0.2ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Fake body"], ["created_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 1], ["locale", :en], ["subject", "Fake subject"], ["updated_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00]]
2116
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2117
+  (0.0ms) SAVEPOINT active_record_1
2118
+ SQL (0.1ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Faux corps 2"], ["created_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 2], ["locale", :fr], ["subject", "Faux subjet 2"], ["updated_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00]]
2119
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2120
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."emailable_id" = ? AND "custom_emails_emails"."emailable_type" = ? AND "custom_emails_emails"."locale" = 'fr' [["emailable_id", 1], ["emailable_type", "Example"]]
2121
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."id" IN (2)
2122
+  (0.2ms) rollback transaction
2123
+  (0.0ms) begin transaction
2124
+ -----------------------------------------------------------
2125
+ ModelsTest: test_the_#emails_by_kind_method_returns_an_Hash
2126
+ -----------------------------------------------------------
2127
+  (0.0ms) rollback transaction
2128
+  (0.0ms) begin transaction
2129
+ -------------------------------------------------------------------------------------
2130
+ ModelsTest: test_the_#emails_by_kind_method_returns_an_Hash_of_emails_grouped_by_kind
2131
+ -------------------------------------------------------------------------------------
2132
+  (0.0ms) SAVEPOINT active_record_1
2133
+ SQL (0.1ms) INSERT INTO "examples" DEFAULT VALUES
2134
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2135
+  (0.0ms) SAVEPOINT active_record_1
2136
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
2137
+ SQL (0.2ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00]]
2138
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2139
+  (0.0ms) SAVEPOINT active_record_1
2140
+ CustomEmails::EmailKind Exists (0.0ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_2' LIMIT 1
2141
+ SQL (0.1ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00], ["name", :kind_2], ["updated_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00]]
2142
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2143
+  (0.0ms) SAVEPOINT active_record_1
2144
+ SQL (0.1ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Fake body"], ["created_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 1], ["locale", :en], ["subject", "Fake subject"], ["updated_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00]]
2145
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2146
+  (0.0ms) SAVEPOINT active_record_1
2147
+ SQL (0.1ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Fake body 2"], ["created_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 2], ["locale", :en], ["subject", "Fake subject 2"], ["updated_at", Tue, 24 Dec 2013 11:21:49 UTC +00:00]]
2148
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2149
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."emailable_id" = ? AND "custom_emails_emails"."emailable_type" = ? [["emailable_id", 1], ["emailable_type", "Example"]]
2150
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."id" IN (1, 2)
2151
+  (0.1ms) rollback transaction
2152
+  (60.5ms) CREATE TABLE "custom_emails_email_kinds" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime) 
2153
+  (51.2ms) CREATE UNIQUE INDEX "index_custom_emails_email_kinds_on_name" ON "custom_emails_email_kinds" ("name")
2154
+  (165.6ms) CREATE TABLE "custom_emails_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "emailable_id" integer, "emailable_type" varchar(255), "locale" varchar(255), "subject" text, "content_text" text, "content_html" text, "created_at" datetime, "updated_at" datetime, "kind_id" integer) 
2155
+  (62.1ms) CREATE INDEX "index_custom_emails_emails_on_emailable_id" ON "custom_emails_emails" ("emailable_id")
2156
+  (51.4ms) CREATE INDEX "index_custom_emails_emails_on_kind_id_and_emailable_id" ON "custom_emails_emails" ("kind_id", "emailable_id")
2157
+  (50.9ms) CREATE UNIQUE INDEX "unique_w_kind_locale_and_emailable" ON "custom_emails_emails" ("kind_id", "locale", "emailable_id", "emailable_type")
2158
+  (92.4ms) CREATE INDEX "index_custom_emails_emails_on_locale" ON "custom_emails_emails" ("locale")
2159
+  (100.9ms) CREATE TABLE "custom_emails_short_message_kinds" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime)
2160
+  (51.7ms) CREATE UNIQUE INDEX "index_custom_emails_short_message_kinds_on_name" ON "custom_emails_short_message_kinds" ("name")
2161
+  (50.7ms) CREATE TABLE "custom_emails_short_messages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "messageable_id" integer, "messageable_type" varchar(255), "kind_id" integer, "locale" varchar(255), "content" text, "created_at" datetime, "updated_at" datetime)
2162
+  (59.8ms) CREATE UNIQUE INDEX "unique_w_kind_locale_and_messageable" ON "custom_emails_short_messages" ("kind_id", "locale", "messageable_id", "messageable_type")
2163
+  (102.5ms) CREATE INDEX "index_w_kind_and_messageable" ON "custom_emails_short_messages" ("kind_id", "messageable_id")
2164
+  (51.1ms) CREATE INDEX "index_custom_emails_short_messages_on_locale" ON "custom_emails_short_messages" ("locale")
2165
+  (50.9ms) CREATE INDEX "index_custom_emails_short_messages_on_messageable_id" ON "custom_emails_short_messages" ("messageable_id")
2166
+  (68.0ms) CREATE TABLE "examples" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL) 
2167
+  (109.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
2168
+  (51.3ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
2169
+  (0.1ms) SELECT version FROM "schema_migrations"
2170
+  (51.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20131224105500')
2171
+  (51.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20131018164626')
2172
+  (119.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20131224105400')
2173
+  (51.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20131018143726')
2174
+  (51.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20131018141445')
2175
+  (0.1ms) begin transaction
2176
+ ----------------------------------------------------------------------------------
2177
+ CustomEmails::EmailTest: test_email_has_a_#to_method_that_produces_a_Mail::Message
2178
+ ----------------------------------------------------------------------------------
2179
+
2180
+ Sent mail to foo@bar.org (5.4ms)
2181
+ Date: Tue, 24 Dec 2013 12:22:29 +0100
2182
+ From: sender@example.org
2183
+ To: foo@bar.org
2184
+ Message-ID: <52b96e75db561_36683fd54018fe84764dc@chocapic.mail>
2185
+ Subject:
2186
+ Mime-Version: 1.0
2187
+ Content-Type: text/plain;
2188
+ charset=UTF-8
2189
+ Content-Transfer-Encoding: 7bit
2190
+
2191
+
2192
+  (0.1ms) rollback transaction
2193
+  (0.1ms) begin transaction
2194
+ ----------------------------------------------------------------------------------------------------------
2195
+ CustomEmails::EmailTest: test_email_has_interpolation_via_liquid_on_subject,_content_text_and_content_html
2196
+ ----------------------------------------------------------------------------------------------------------
2197
+  (0.0ms) rollback transaction
2198
+  (0.0ms) begin transaction
2199
+ -------------------------------------------------------------------
2200
+ CustomEmails::EmailTest: test_email_is_scoped_to_an_emailable_model
2201
+ -------------------------------------------------------------------
2202
+  (0.0ms) rollback transaction
2203
+  (0.0ms) begin transaction
2204
+ --------------------------------------------------------------------------------------------
2205
+ CustomEmails::EmailTest: test_email_needs_kind,_locale,_subject_and_content_text_to_be_valid
2206
+ --------------------------------------------------------------------------------------------
2207
+  (0.1ms) rollback transaction
2208
+  (0.0ms) begin transaction
2209
+ ------------------------------------------------------------------------------------------
2210
+ CustomEmails::ShortMessageTest: test_Short_message_has_interpolation_via_liquid_on_content
2211
+ ------------------------------------------------------------------------------------------
2212
+  (0.0ms) rollback transaction
2213
+  (0.0ms) begin transaction
2214
+ ------------------------------------------------------------------------------------
2215
+ CustomEmails::ShortMessageTest: test_short_message_is_scoped_to_an_messageable_model
2216
+ ------------------------------------------------------------------------------------
2217
+  (0.0ms) rollback transaction
2218
+  (0.0ms) begin transaction
2219
+ ---------------------------------------------------------------------------------------------
2220
+ CustomEmails::ShortMessageTest: test_short_message_needs_kind,_locale_and_content_to_be_valid
2221
+ ---------------------------------------------------------------------------------------------
2222
+  (0.1ms) rollback transaction
2223
+  (0.0ms) begin transaction
2224
+ ----------------------------
2225
+ CustomEmailsTest: test_truth
2226
+ ----------------------------
2227
+  (0.0ms) rollback transaction
2228
+  (0.0ms) begin transaction
2229
+ ----------------------------------------------------------------------------------
2230
+ MailerTest: test_custom_email_to_raises_an_exception_if_there_is_no_matching_email
2231
+ ----------------------------------------------------------------------------------
2232
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
2233
+  (0.0ms) SAVEPOINT active_record_1
2234
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
2235
+ SQL (0.6ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:22:29 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:22:29 UTC +00:00]]
2236
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2237
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
2238
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."kind_id" = 1 AND "custom_emails_emails"."emailable_id" IS NULL AND "custom_emails_emails"."locale" = 'en' LIMIT 1
2239
+  (0.0ms) SAVEPOINT active_record_1
2240
+ SQL (0.2ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content_text", "Good luck..."], ["created_at", Tue, 24 Dec 2013 11:22:29 UTC +00:00], ["kind_id", 1], ["locale", :fr], ["subject", "Hello world!"], ["updated_at", Tue, 24 Dec 2013 11:22:29 UTC +00:00]]
2241
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2242
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
2243
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."kind_id" = 1 AND "custom_emails_emails"."emailable_id" IS NULL AND "custom_emails_emails"."locale" = 'en' LIMIT 1
2244
+  (0.1ms) rollback transaction
2245
+  (0.0ms) begin transaction
2246
+ --------------------------------------------------------------------------------------
2247
+ MailerTest: test_email_interpolated_attributes_are_used_when_custom_email_to_is_called
2248
+ --------------------------------------------------------------------------------------
2249
+  (0.0ms) SAVEPOINT active_record_1
2250
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
2251
+ SQL (0.1ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:22:29 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:22:29 UTC +00:00]]
2252
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2253
+  (0.0ms) SAVEPOINT active_record_1
2254
+ SQL (0.2ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content_text", "Good luck {{ name }}..."], ["created_at", Tue, 24 Dec 2013 11:22:29 UTC +00:00], ["kind_id", 1], ["locale", :en], ["subject", "Hello {{ name }}!"], ["updated_at", Tue, 24 Dec 2013 11:22:29 UTC +00:00]]
2255
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2256
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
2257
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."kind_id" = 1 AND "custom_emails_emails"."emailable_id" IS NULL AND "custom_emails_emails"."locale" = 'en' LIMIT 1
2258
+
2259
+ Sent mail to test@example.com (3.6ms)
2260
+ Date: Tue, 24 Dec 2013 12:22:29 +0100
2261
+ From: sender@example.org
2262
+ To: test@example.com
2263
+ Message-ID: <52b96e75e827d_36683fd54018fe8476554@chocapic.mail>
2264
+ Subject: Hello Luc!
2265
+ Mime-Version: 1.0
2266
+ Content-Type: text/plain;
2267
+ charset=UTF-8
2268
+ Content-Transfer-Encoding: 7bit
2269
+
2270
+ Good luck Luc...
2271
+  (0.1ms) rollback transaction
2272
+  (24.5ms) begin transaction
2273
+ -----------------------------------------------------------------------------------
2274
+ ModelsTest: test_models_using_has_custom_emails_ends_with_an_#emails_by_kind_method
2275
+ -----------------------------------------------------------------------------------
2276
+  (0.1ms) rollback transaction
2277
+  (0.0ms) begin transaction
2278
+ -----------------------------------------------------------------------------
2279
+ ModelsTest: test_models_using_has_custom_emails_ends_with_an_:emails_relation
2280
+ -----------------------------------------------------------------------------
2281
+  (0.0ms) rollback transaction
2282
+  (0.0ms) begin transaction
2283
+ --------------------------------------------------------------------------------------------
2284
+ ModelsTest: test_the_#emails_by_kind_method_accepts_an_optional_argument_to_filter_by_locale
2285
+ --------------------------------------------------------------------------------------------
2286
+  (0.0ms) SAVEPOINT active_record_1
2287
+ SQL (0.1ms) INSERT INTO "examples" DEFAULT VALUES
2288
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2289
+  (0.0ms) SAVEPOINT active_record_1
2290
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
2291
+ SQL (0.2ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:22:29 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:22:29 UTC +00:00]]
2292
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2293
+  (0.0ms) SAVEPOINT active_record_1
2294
+ CustomEmails::EmailKind Exists (0.0ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_2' LIMIT 1
2295
+ SQL (0.1ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:22:29 UTC +00:00], ["name", :kind_2], ["updated_at", Tue, 24 Dec 2013 11:22:29 UTC +00:00]]
2296
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2297
+  (0.1ms) SAVEPOINT active_record_1
2298
+ SQL (0.2ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Fake body"], ["created_at", Tue, 24 Dec 2013 11:22:29 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 1], ["locale", :en], ["subject", "Fake subject"], ["updated_at", Tue, 24 Dec 2013 11:22:29 UTC +00:00]]
2299
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2300
+  (0.0ms) SAVEPOINT active_record_1
2301
+ SQL (0.1ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Faux corps 2"], ["created_at", Tue, 24 Dec 2013 11:22:29 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 2], ["locale", :fr], ["subject", "Faux subjet 2"], ["updated_at", Tue, 24 Dec 2013 11:22:29 UTC +00:00]]
2302
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2303
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."emailable_id" = ? AND "custom_emails_emails"."emailable_type" = ? AND "custom_emails_emails"."locale" = 'fr' [["emailable_id", 1], ["emailable_type", "Example"]]
2304
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."id" IN (2)
2305
+  (0.1ms) rollback transaction
2306
+  (0.0ms) begin transaction
2307
+ -----------------------------------------------------------
2308
+ ModelsTest: test_the_#emails_by_kind_method_returns_an_Hash
2309
+ -----------------------------------------------------------
2310
+  (0.0ms) rollback transaction
2311
+  (0.0ms) begin transaction
2312
+ -------------------------------------------------------------------------------------
2313
+ ModelsTest: test_the_#emails_by_kind_method_returns_an_Hash_of_emails_grouped_by_kind
2314
+ -------------------------------------------------------------------------------------
2315
+  (0.0ms) SAVEPOINT active_record_1
2316
+ SQL (0.1ms) INSERT INTO "examples" DEFAULT VALUES
2317
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2318
+  (0.0ms) SAVEPOINT active_record_1
2319
+ CustomEmails::EmailKind Exists (0.1ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_1' LIMIT 1
2320
+ SQL (0.2ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:22:30 UTC +00:00], ["name", :kind_1], ["updated_at", Tue, 24 Dec 2013 11:22:30 UTC +00:00]]
2321
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2322
+  (0.0ms) SAVEPOINT active_record_1
2323
+ CustomEmails::EmailKind Exists (0.0ms) SELECT 1 AS one FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."name" = 'kind_2' LIMIT 1
2324
+ SQL (0.1ms) INSERT INTO "custom_emails_email_kinds" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Dec 2013 11:22:30 UTC +00:00], ["name", :kind_2], ["updated_at", Tue, 24 Dec 2013 11:22:30 UTC +00:00]]
2325
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2326
+  (0.0ms) SAVEPOINT active_record_1
2327
+ SQL (0.1ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Fake body"], ["created_at", Tue, 24 Dec 2013 11:22:30 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 1], ["locale", :en], ["subject", "Fake subject"], ["updated_at", Tue, 24 Dec 2013 11:22:30 UTC +00:00]]
2328
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2329
+  (0.0ms) SAVEPOINT active_record_1
2330
+ SQL (0.1ms) INSERT INTO "custom_emails_emails" ("content_text", "created_at", "emailable_id", "emailable_type", "kind_id", "locale", "subject", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["content_text", "Fake body 2"], ["created_at", Tue, 24 Dec 2013 11:22:30 UTC +00:00], ["emailable_id", 1], ["emailable_type", "Example"], ["kind_id", 2], ["locale", :en], ["subject", "Fake subject 2"], ["updated_at", Tue, 24 Dec 2013 11:22:30 UTC +00:00]]
2331
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2332
+ CustomEmails::Email Load (0.1ms) SELECT "custom_emails_emails".* FROM "custom_emails_emails" WHERE "custom_emails_emails"."emailable_id" = ? AND "custom_emails_emails"."emailable_type" = ? [["emailable_id", 1], ["emailable_type", "Example"]]
2333
+ CustomEmails::EmailKind Load (0.1ms) SELECT "custom_emails_email_kinds".* FROM "custom_emails_email_kinds" WHERE "custom_emails_email_kinds"."id" IN (1, 2)
2334
+  (0.1ms) rollback transaction