- ##
- # test the inbox action
- def test_inbox
- user = create(:user)
- read_message = create(:message, :read, :recipient => user)
- # Check that the inbox page requires us to login
- get inbox_messages_path
- assert_redirected_to login_path(:referer => inbox_messages_path)
-
- # Login
- session_for(user)
-
- # Check that we can view our inbox when logged in
- get inbox_messages_path
- assert_response :success
- assert_template "inbox"
- assert_select ".content-inner > table", :count => 1 do
- assert_select "tr", :count => 2
- assert_select "tr#inbox-#{read_message.id}.inbox-row", :count => 1 do
- assert_select "a[href='#{user_path read_message.sender}']", :text => read_message.sender.display_name
- assert_select "a[href='#{message_path read_message}']", :text => read_message.title
- end
- end
- end
-
- ##
- # test the outbox action
- def test_outbox
- user = create(:user)
- message = create(:message, :sender => user)
-
- # Check that the outbox page requires us to login
- get outbox_messages_path
- assert_redirected_to login_path(:referer => outbox_messages_path)
-
- # Login
- session_for(user)
-
- # Check that we can view our outbox when logged in
- get outbox_messages_path
- assert_response :success
- assert_template "outbox"
- assert_select ".content-inner > table", :count => 1 do
- assert_select "tr", :count => 2
- assert_select "tr.inbox-row", :count => 1 do
- assert_select "a[href='#{user_path message.recipient}']", :text => message.recipient.display_name
- assert_select "a[href='#{message_path message}']", :text => message.title
- end
- end
- end
-