adding first integration for testing user diaries, as multiple controllers are required. more work required.

This commit is contained in:
Shaun McDonald 2008-11-09 19:51:56 +00:00
parent 4adeeb51ad
commit 5ed41857f7
2 changed files with 54 additions and 1 deletions

View file

@ -1,6 +1,8 @@
require File.dirname(__FILE__) + '/../test_helper' require File.dirname(__FILE__) + '/../test_helper'
require 'app/controllers/user_controller.rb'
class DiaryEntryControllerTest < ActionController::TestCase class DiaryEntryControllerTest < ActionController::TestCase
fixtures :users, :diary_entries, :diary_comments
def basic_authorization(user, pass) def basic_authorization(user, pass)
@request.env["HTTP_AUTHORIZATION"] = "Basic %s" % Base64.encode64("#{user}:#{pass}") @request.env["HTTP_AUTHORIZATION"] = "Basic %s" % Base64.encode64("#{user}:#{pass}")
end end
@ -10,11 +12,32 @@ class DiaryEntryControllerTest < ActionController::TestCase
end end
def test_showing_create_diary_entry def test_showing_create_diary_entry
get :new
assert_response 302
assert_redirected_to :controller => :user, :action => "login", :referer => "/diary_entry/new"
# can't really redirect to the
#follow_redirect
# Now login
#post :login, :user_email => "test@openstreetmap.org", :user_password => "test"
#get :controller => :users, :action => :new
#assert_response :success
#print @response.to_yaml
#assert_select "html" do
# assert_select "body" do
# assert_select "div#content" do
# assert_select "form" do
# assert_select "input[id=diary_entry_title]"
# end
# end
# end
#end
end end
def test_editing_diary_entry def test_editing_diary_entry
get :edit
assert :not_authorized
end end
def test_editing_creating_diary_comment def test_editing_creating_diary_comment
@ -26,6 +49,8 @@ class DiaryEntryControllerTest < ActionController::TestCase
end end
def test_rss def test_rss
get :rss
assert :success
end end

View file

@ -0,0 +1,28 @@
require 'test_helper'
class UserDiariesTest < ActionController::IntegrationTest
fixtures :users, :diary_entries
def test_showing_create_diary_entry
get '/user/test/diary/new'
assert_response 302
assert_redirected_to :controller => :user, :action => "login", :referer => "/user/test/diary/new"
#follow_redirect
# Now login
#post :login, :user_email => "test@openstreetmap.org", :user_password => "test"
#
#get :controller => :users, :action => :new
#assert_response :success
#print @response.to_yaml
#assert_select "html" do
# assert_select "body" do
# assert_select "div#content" do
# assert_select "form" do
# assert_select "input[id=diary_entry_title]"
# end
# end
# end
#end
end
end