4 class InboxesControllerTest < ActionDispatch::IntegrationTest
6 # test all routes which lead to this controller
9 { :path => "/messages/inbox", :method => :get },
10 { :controller => "messages/inboxes", :action => "show" }
16 read_message = create(:message, :read, :recipient => user)
20 get messages_inbox_path
21 assert_response :success
22 assert_select ".content-inner > table.messages-table > tbody", :count => 1 do
23 assert_select "tr", :count => 1
24 assert_select "tr#inbox-#{read_message.id}", :count => 1 do
25 assert_select "a[href='#{user_path read_message.sender}']", :text => read_message.sender.display_name
26 assert_select "a[href='#{message_path read_message}']", :text => read_message.title
31 def test_show_requires_login
32 get messages_inbox_path
33 assert_redirected_to login_path(:referer => messages_inbox_path)