Test for contact form not working.

I’m working with Rails 4 and have developed a test that is failing and I don’t understand why.

test “message content” do
message = messages(:two)
mail = MessageMailer.new_message(message)
assert_equal “Message from #{message.name}”, mail.subject
assert_equal [“info@example.com”], mail.to
assert_equal message.email, mail.from
assert_match message.content, mail.body.encoded
assert_match CGI::escape(message.email), mail.body.encoded # Test if it is an escaped email address, which a.o. means that the @ is converted to browser-friendly code: %40.
end

The last three test lines all three fail. I get the error message:
FAIL[“test_message_content”, MessageMailerTest, 3.994477556]
test_message_content#MessageMailerTest (3.99s)
Expected: nil
Actual: []
test/mailers/message_mailer_test.rb:10:in `block in class:MessageMailerTest’ (this refers to the assert_equal message.email line)

I don’t understand why it is expected nul and actually empty.

My fixtures include:
two:
name: MyString
email: noreply2@example.com
content: MyString

The message mailer is:
default from: “noreply@example.com
default to: “Website info@example.com
def new_message(message)
@message = message
mail subject: “Message from #{message.name}”, from: message.email
end

Anyone got an idea what is going wrong?

I'm working with Rails 4 and have developed a test that is failing and I
don't understand why.

  test "message content" do

Try a
puts messages(:two).inspect
at this point to get more clues as to what is happening.

Colin