+ def test_unsubscribe_page
+ user = create(:user)
+ other_user = create(:user)
+ diary_entry = create(:diary_entry, :user => user)
+ path = diary_entry_unsubscribe_path(:id => diary_entry, :display_name => user.display_name)
+
+ get path
+ assert_response :redirect
+ assert_redirected_to login_path(:referer => path)
+
+ session_for(other_user)
+ get path
+ assert_response :success
+ assert_dom ".content-body" do
+ assert_dom "a[href='#{diary_entry_path(:id => diary_entry, :display_name => user.display_name)}']", :text => diary_entry.title
+ assert_dom "a[href='#{user_path(user)}']", :text => user.display_name
+ end
+ end
+