Sha256: b4c497afb0f66557662ff034da81490854ba2c6cb46fe977da85e00ffd94823d

Contents?: true

Size: 883 Bytes

Versions: 2

Compression:

Stored size: 883 Bytes

Contents

require 'test_helper'

class BarkestCore::ContactFormTest < ActionMailer::TestCase
  def setup
    @msg = BarkestCore::ContactMessage.new(
        your_name: 'John Doe',
        your_email: 'jdoe@example.com',
        related_to: 'Other',
        subject: 'Hello world',
        body: 'Hello world from the contact form.',
        remote_ip: '127.0.0.1'
    )
  end

  test "contact" do
    mail = BarkestCore::ContactForm.contact(@msg)
    assert_equal @msg.full_subject, mail.subject

    assert_equal [BarkestCore::ContactForm.default_recipient], mail.to, 'Recipient is wrong.'
    assert_equal [BarkestCore::ContactForm.default_sender], mail.from, 'Sender is wrong.'

    assert_match @msg.your_name, mail.body.encoded
    assert_match @msg.your_email, mail.body.encoded
    assert_match @msg.body, mail.body.encoded
    assert_match @msg.remote_ip, mail.body.encoded
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
barkest_core-1.5.4.0 test/mailers/barkest_core/contact_form_test.rb
barkest_core-1.5.3.0 test/mailers/barkest_core/contact_form_test.rb