1 require File.dirname(__FILE__) + '/../test_helper'
2 require 'app/controllers/user_controller.rb'
4 class DiaryEntryControllerTest < ActionController::TestCase
5 fixtures :users, :diary_entries, :diary_comments
6 def basic_authorization(user, pass)
7 @request.env["HTTP_AUTHORIZATION"] = "Basic %s" % Base64.encode64("#{user}:#{pass}")
11 @request.env["RAW_POST_DATA"] = c.to_s
14 def test_showing_create_diary_entry
17 assert_redirected_to :controller => :user, :action => "login", :referer => "/diary_entry/new"
18 # Now pretend to login by using the session hash, with the
19 # id of the person we want to login as through session(:user)=user.id
20 get(:new, nil, {'user' => users(:normal_user).id})
21 assert_response :success
24 #print @response.to_yaml
25 assert_select "html" do
26 assert_select "body" do
27 assert_select "div#content" do
28 assert_select "form" do
29 assert_select "input[id=diary_entry_title]"
37 def test_editing_diary_entry
39 assert :not_authorized
42 def test_editing_creating_diary_comment
46 def test_listing_diary_entries
56 def test_viewing_diary_entry