1 require File.dirname(__FILE__) + '/../test_helper'
3 class DiaryEntryControllerTest < ActionController::TestCase
4 fixtures :users, :diary_entries, :diary_comments
5 def basic_authorization(user, pass)
6 @request.env["HTTP_AUTHORIZATION"] = "Basic %s" % Base64.encode64("#{user}:#{pass}")
10 @request.env["RAW_POST_DATA"] = c.to_s
13 def test_showing_create_diary_entry
16 assert_redirected_to :controller => :user, :action => "login", :referer => "/diary_entry/new"
17 # Now pretend to login by using the session hash, with the
18 # id of the person we want to login as through session(:user)=user.id
19 get(:new, nil, {'user' => users(:normal_user).id})
20 assert_response :success
23 #print @response.to_yaml
24 assert_select "html:root", :count => 1 do
25 assert_select "body" do
26 assert_select "div#content" do
27 assert_select "h1", "New diary entry"
28 assert_select "form[action='/diary_entry/new']" do
29 assert_select "input[id=diary_entry_title][name='diary_entry[title]']"
30 assert_select "textarea#diary_entry_body[name='diary_entry[body]']"
38 def test_editing_diary_entry
40 assert :not_authorized
43 def test_editing_creating_diary_comment
47 def test_listing_diary_entries
57 def test_viewing_diary_entry