simple_contact 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/simple_contact/contact_controller.rb +4 -1
- data/app/mailers/simple_contact/contact_mailer.rb +11 -1
- data/app/models/simple_contact/message.rb +9 -3
- data/app/views/simple_contact/contact/new.html.erb +34 -22
- data/app/views/simple_contact/contact_mailer/contact_message.html.erb +6 -0
- data/config/locales/en.yml +3 -2
- data/config/routes.rb +1 -1
- data/lib/simple_contact/version.rb +1 -1
- data/test/dummy/log/test.log +1906 -0
- data/test/mailers/contact_mailer_test.rb +10 -4
- metadata +1 -1
@@ -4,22 +4,28 @@ class SimpleContact::ContactMailerTest < ActionMailer::TestCase
|
|
4
4
|
|
5
5
|
before do
|
6
6
|
@routes = SimpleContact::Engine.routes
|
7
|
+
# Tests that single email addresses or multiple comma separated email address work as well.
|
7
8
|
ENV['SIMPLE_CONTACT_TO_EMAIL'] = 'test@example.com'
|
9
|
+
ENV['SIMPLE_CONTACT_CC_EMAIL'] = 'cc_me@example.com, cc_me2@example.com'
|
10
|
+
ENV['SIMPLE_CONTACT_BCC_EMAIL'] = 'bcc_me@example.com, bcc_me2@example.com'
|
8
11
|
ENV['SIMPLE_CONTACT_SUBJECT_PREFIX'] = "[Simple Contact]"
|
12
|
+
|
9
13
|
@message = build(:message)
|
10
14
|
@email = SimpleContact::ContactMailer.contact_message(@message).deliver
|
11
15
|
end
|
12
16
|
|
13
|
-
it "is delivered to
|
14
|
-
assert_equal @email.to.
|
17
|
+
it "is delivered to the appropriate addresses" do
|
18
|
+
assert_equal @email.to.join(', '), ENV['SIMPLE_CONTACT_TO_EMAIL']
|
19
|
+
assert_equal @email.cc.join(', '), ENV['SIMPLE_CONTACT_CC_EMAIL']
|
20
|
+
assert_equal @email.bcc.join(', '), ENV['SIMPLE_CONTACT_BCC_EMAIL']
|
15
21
|
end
|
16
22
|
|
17
23
|
it "is delivered from the senders email" do
|
18
|
-
assert_equal @email.from.
|
24
|
+
assert_equal @email.from.first, @message.email
|
19
25
|
end
|
20
26
|
|
21
27
|
it "is delivered with an appropriate subject" do
|
22
|
-
assert_equal @email.subject,
|
28
|
+
assert_equal @email.subject, [ENV['SIMPLE_CONTACT_SUBJECT_PREFIX'], @message.subject].join(' ')
|
23
29
|
end
|
24
30
|
|
25
31
|
end
|