Site para o estudio Velvet Design em São Paulo. http://velvetdesign.com.br

contact_messages_controller_test.rb 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. require 'test_helper'
  2. class ContactMessagesControllerTest < ActionController::TestCase
  3. setup do
  4. @contact_message = contact_messages(:one)
  5. end
  6. test "should get index" do
  7. get :index
  8. assert_response :success
  9. assert_not_nil assigns(:contact_messages)
  10. end
  11. test "should get new" do
  12. get :new
  13. assert_response :success
  14. end
  15. test "should create contact_message" do
  16. assert_difference('ContactMessage.count') do
  17. post :create, contact_message: { content: @contact_message.content, email: @contact_message.email, title: @contact_message.title, unread: @contact_message.unread, user_id: @contact_message.user_id }
  18. end
  19. assert_redirected_to contact_message_path(assigns(:contact_message))
  20. end
  21. test "should show contact_message" do
  22. get :show, id: @contact_message
  23. assert_response :success
  24. end
  25. test "should get edit" do
  26. get :edit, id: @contact_message
  27. assert_response :success
  28. end
  29. test "should update contact_message" do
  30. patch :update, id: @contact_message, contact_message: { content: @contact_message.content, email: @contact_message.email, title: @contact_message.title, unread: @contact_message.unread, user_id: @contact_message.user_id }
  31. assert_redirected_to contact_message_path(assigns(:contact_message))
  32. end
  33. test "should destroy contact_message" do
  34. assert_difference('ContactMessage.count', -1) do
  35. delete :destroy, id: @contact_message
  36. end
  37. assert_redirected_to contact_messages_path
  38. end
  39. end