simple_contact 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 simple_contact_to_email" do
14
- assert_equal @email.to.pop, ENV['SIMPLE_CONTACT_TO_EMAIL']
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.pop, @message.email
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, "#{ENV['SIMPLE_CONTACT_SUBJECT_PREFIX']} #{@message.subject}"
28
+ assert_equal @email.subject, [ENV['SIMPLE_CONTACT_SUBJECT_PREFIX'], @message.subject].join(' ')
23
29
  end
24
30
 
25
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_contact
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Eggett