From 5ed41857f723daff3c9d9de810654a6d5c9b01ba Mon Sep 17 00:00:00 2001 From: Shaun McDonald Date: Sun, 9 Nov 2008 19:51:56 +0000 Subject: [PATCH] adding first integration for testing user diaries, as multiple controllers are required. more work required. --- .../functional/diary_entry_controller_test.rb | 27 +++++++++++++++++- test/integration/user_diaries_test.rb | 28 +++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 test/integration/user_diaries_test.rb diff --git a/test/functional/diary_entry_controller_test.rb b/test/functional/diary_entry_controller_test.rb index 7eebfa57e..a8d0adf6d 100644 --- a/test/functional/diary_entry_controller_test.rb +++ b/test/functional/diary_entry_controller_test.rb @@ -1,6 +1,8 @@ require File.dirname(__FILE__) + '/../test_helper' +require 'app/controllers/user_controller.rb' class DiaryEntryControllerTest < ActionController::TestCase + fixtures :users, :diary_entries, :diary_comments def basic_authorization(user, pass) @request.env["HTTP_AUTHORIZATION"] = "Basic %s" % Base64.encode64("#{user}:#{pass}") end @@ -10,11 +12,32 @@ class DiaryEntryControllerTest < ActionController::TestCase end 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 def test_editing_diary_entry - + get :edit + assert :not_authorized end def test_editing_creating_diary_comment @@ -26,6 +49,8 @@ class DiaryEntryControllerTest < ActionController::TestCase end def test_rss + get :rss + assert :success end diff --git a/test/integration/user_diaries_test.rb b/test/integration/user_diaries_test.rb new file mode 100644 index 000000000..7ec743804 --- /dev/null +++ b/test/integration/user_diaries_test.rb @@ -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 -- 2.39.5