On 17 April 2015 at 17:16,  <[email protected]> wrote:
> 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

>     message = messages(:two)
>     mail = MessageMailer.new_message(message)
>     assert_equal "Message from #{message.name}",      mail.subject
>     assert_equal ["[email protected]"],                              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: [email protected]
>   content: MyString
>
> The message mailer is:
>   default from: "<[email protected]>"
>   default to: "Website <[email protected]>"
>   def new_message(message)
>     @message = message
>     mail subject: "Message from #{message.name}", from: message.email
>   end
>
> Anyone got an idea what is going wrong?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/8d1f4561-cf2b-4a02-8154-15a0cd9319fe%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuE6FYQP8Xy4ATVBzct-mObgCVmiKhJDtkFd%2BZbkMGhcg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to