summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-02-21 11:04:50 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-02-21 11:04:50 +0000
commitfe28193e4eb9af2dc5262535a29ffde5249568fc (patch)
treebd4cf3a9fbada98e58e510ca0e25c42bf00676a7 /test/functional
parent9a986ac0a51fe844eee816325e6a6d4122136d9a (diff)
downloadredmine-fe28193e4eb9af2dc5262535a29ffde5249568fc.tar.gz
redmine-fe28193e4eb9af2dc5262535a29ffde5249568fc.zip
Merged Rails 2.2 branch. Redmine now requires Rails 2.2.2.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2493 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/application_controller_test.rb8
-rw-r--r--test/functional/attachments_controller_test.rb2
-rw-r--r--test/functional/custom_fields_controller_test.rb2
-rw-r--r--test/functional/issues_controller_test.rb2
-rw-r--r--test/functional/messages_controller_test.rb8
-rw-r--r--test/functional/news_controller_test.rb6
-rw-r--r--test/functional/projects_controller_test.rb8
-rw-r--r--test/functional/repositories_controller_test.rb2
-rw-r--r--test/functional/search_controller_test.rb2
-rw-r--r--test/functional/timelog_controller_test.rb2
-rw-r--r--test/functional/welcome_controller_test.rb2
-rw-r--r--test/functional/wikis_controller_test.rb2
12 files changed, 25 insertions, 21 deletions
diff --git a/test/functional/application_controller_test.rb b/test/functional/application_controller_test.rb
index 7d1cc8391..0232b6a4d 100644
--- a/test/functional/application_controller_test.rb
+++ b/test/functional/application_controller_test.rb
@@ -22,6 +22,8 @@ require 'application'
class ApplicationController; def rescue_action(e) raise e end; end
class ApplicationControllerTest < Test::Unit::TestCase
+ include Redmine::I18n
+
def setup
@controller = ApplicationController.new
@request = ActionController::TestRequest.new
@@ -30,9 +32,9 @@ class ApplicationControllerTest < Test::Unit::TestCase
# check that all language files are valid
def test_localization
- lang_files_count = Dir["#{RAILS_ROOT}/lang/*.yml"].size
- assert_equal lang_files_count, GLoc.valid_languages.size
- GLoc.valid_languages.each do |lang|
+ lang_files_count = Dir["#{RAILS_ROOT}/config/locales/*.yml"].size
+ assert_equal lang_files_count, valid_languages.size
+ valid_languages.each do |lang|
assert set_language_if_valid(lang)
end
set_language_if_valid('en')
diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb
index 634d4279b..43650bdfd 100644
--- a/test/functional/attachments_controller_test.rb
+++ b/test/functional/attachments_controller_test.rb
@@ -86,7 +86,7 @@ class AttachmentsControllerTest < Test::Unit::TestCase
post :destroy, :id => 1
end
# no referrer
- assert_redirected_to 'projects/show/ecookbook'
+ assert_redirected_to 'projects/ecookbook'
assert_nil Attachment.find_by_id(1)
j = issue.journals.find(:first, :order => 'created_on DESC')
assert_equal 'attachment', j.details.first.property
diff --git a/test/functional/custom_fields_controller_test.rb b/test/functional/custom_fields_controller_test.rb
index 42dedb3c1..10af23563 100644
--- a/test/functional/custom_fields_controller_test.rb
+++ b/test/functional/custom_fields_controller_test.rb
@@ -47,7 +47,7 @@ class CustomFieldsControllerTest < Test::Unit::TestCase
:field_format => "list",
:tracker_ids => ["1", ""]}
end
- assert_redirected_to '/custom_fields'
+ assert_redirected_to '/custom_fields?tab=IssueCustomField'
field = IssueCustomField.find_by_name('test_post_new_list')
assert_not_nil field
assert_equal ["0.1", "0.2"], field.possible_values
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 25100f9a0..ebc2aa8b8 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -445,7 +445,7 @@ class IssuesControllerTest < Test::Unit::TestCase
assert_template 'new'
issue = assigns(:issue)
assert_not_nil issue
- assert_equal 'activerecord_error_invalid', issue.errors.on(:custom_values)
+ assert_equal I18n.translate('activerecord.errors.messages.invalid'), issue.errors.on(:custom_values)
end
def test_post_new_with_watchers
diff --git a/test/functional/messages_controller_test.rb b/test/functional/messages_controller_test.rb
index d19249c06..94062b402 100644
--- a/test/functional/messages_controller_test.rb
+++ b/test/functional/messages_controller_test.rb
@@ -87,9 +87,9 @@ class MessagesControllerTest < Test::Unit::TestCase
post :new, :board_id => 1,
:message => { :subject => 'Test created message',
:content => 'Message body'}
- assert_redirected_to 'messages/show'
message = Message.find_by_subject('Test created message')
assert_not_nil message
+ assert_redirected_to "boards/1/topics/#{message.to_param}"
assert_equal 'Message body', message.content
assert_equal 2, message.author_id
assert_equal 1, message.board_id
@@ -127,7 +127,7 @@ class MessagesControllerTest < Test::Unit::TestCase
post :edit, :board_id => 1, :id => 1,
:message => { :subject => 'New subject',
:content => 'New body'}
- assert_redirected_to 'messages/show'
+ assert_redirected_to 'boards/1/topics/1'
message = Message.find(1)
assert_equal 'New subject', message.subject
assert_equal 'New body', message.content
@@ -143,7 +143,7 @@ class MessagesControllerTest < Test::Unit::TestCase
def test_reply
@request.session[:user_id] = 2
post :reply, :board_id => 1, :id => 1, :reply => { :content => 'This is a test reply', :subject => 'Test reply' }
- assert_redirected_to 'messages/show'
+ assert_redirected_to 'boards/1/topics/1'
assert Message.find_by_subject('Test reply')
end
@@ -157,7 +157,7 @@ class MessagesControllerTest < Test::Unit::TestCase
def test_destroy_topic
@request.session[:user_id] = 2
post :destroy, :board_id => 1, :id => 1
- assert_redirected_to 'boards/show'
+ assert_redirected_to 'projects/ecookbook/boards/1'
assert_nil Message.find_by_id(1)
end
diff --git a/test/functional/news_controller_test.rb b/test/functional/news_controller_test.rb
index 651471b66..009e58c73 100644
--- a/test/functional/news_controller_test.rb
+++ b/test/functional/news_controller_test.rb
@@ -146,7 +146,7 @@ class NewsControllerTest < Test::Unit::TestCase
def test_post_edit
@request.session[:user_id] = 2
post :edit, :id => 1, :news => { :description => 'Description changed by test_post_edit' }
- assert_redirected_to 'news/show/1'
+ assert_redirected_to 'news/1'
news = News.find(1)
assert_equal 'Description changed by test_post_edit', news.description
end
@@ -167,7 +167,7 @@ class NewsControllerTest < Test::Unit::TestCase
def test_add_comment
@request.session[:user_id] = 2
post :add_comment, :id => 1, :comment => { :comments => 'This is a NewsControllerTest comment' }
- assert_redirected_to 'news/show/1'
+ assert_redirected_to 'news/1'
comment = News.find(1).comments.find(:first, :order => 'created_on DESC')
assert_not_nil comment
@@ -179,7 +179,7 @@ class NewsControllerTest < Test::Unit::TestCase
comments_count = News.find(1).comments.size
@request.session[:user_id] = 2
post :destroy_comment, :id => 1, :comment_id => 2
- assert_redirected_to 'news/show/1'
+ assert_redirected_to 'news/1'
assert_nil Comment.find_by_id(2)
assert_equal comments_count - 1, News.find(1).comments.size
end
diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb
index ec5d40a77..371e28424 100644
--- a/test/functional/projects_controller_test.rb
+++ b/test/functional/projects_controller_test.rb
@@ -148,7 +148,7 @@ class ProjectsControllerTest < Test::Unit::TestCase
@request.session[:user_id] = 2 # manager
post :edit, :id => 1, :project => {:name => 'Test changed name',
:issue_custom_field_ids => ['']}
- assert_redirected_to 'projects/settings/ecookbook'
+ assert_redirected_to 'projects/ecookbook/settings'
project = Project.find(1)
assert_equal 'Test changed name', project.name
end
@@ -214,7 +214,7 @@ class ProjectsControllerTest < Test::Unit::TestCase
post :add_file, :id => 1, :version_id => '',
:attachments => {'1' => {'file' => test_uploaded_file('testfile.txt', 'text/plain')}}
end
- assert_redirected_to 'projects/list_files/ecookbook'
+ assert_redirected_to 'projects/ecookbook/files'
a = Attachment.find(:first, :order => 'created_on DESC')
assert_equal 'testfile.txt', a.filename
assert_equal Project.find(1), a.container
@@ -245,7 +245,7 @@ class ProjectsControllerTest < Test::Unit::TestCase
post :add_file, :id => 1, :version_id => '2',
:attachments => {'1' => {'file' => test_uploaded_file('testfile.txt', 'text/plain')}}
end
- assert_redirected_to 'projects/list_files/ecookbook'
+ assert_redirected_to 'projects/ecookbook/files'
a = Attachment.find(:first, :order => 'created_on DESC')
assert_equal 'testfile.txt', a.filename
assert_equal Version.find(2), a.container
@@ -483,7 +483,7 @@ class ProjectsControllerTest < Test::Unit::TestCase
def test_project_menu
assert_no_difference 'Redmine::MenuManager.items(:project_menu).size' do
Redmine::MenuManager.map :project_menu do |menu|
- menu.push :foo, { :controller => 'projects', :action => 'show' }, :cation => 'Foo'
+ menu.push :foo, { :controller => 'projects', :action => 'show' }, :caption => 'Foo'
menu.push :bar, { :controller => 'projects', :action => 'show' }, :before => :activity
menu.push :hello, { :controller => 'projects', :action => 'show' }, :caption => Proc.new {|p| p.name.upcase }, :after => :bar
end
diff --git a/test/functional/repositories_controller_test.rb b/test/functional/repositories_controller_test.rb
index ccf5e77ba..ceb7341b0 100644
--- a/test/functional/repositories_controller_test.rb
+++ b/test/functional/repositories_controller_test.rb
@@ -200,7 +200,7 @@ class RepositoriesControllerTest < Test::Unit::TestCase
assert_no_difference "Changeset.count(:conditions => 'user_id = 3')" do
post :committers, :id => 1, :committers => { '0' => ['foo', '2'], '1' => ['dlopper', '3']}
- assert_redirected_to '/repositories/committers/ecookbook'
+ assert_redirected_to 'projects/ecookbook/repository/committers'
assert_equal User.find(2), c.reload.user
end
end
diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb
index b804bbd28..ec81e417f 100644
--- a/test/functional/search_controller_test.rb
+++ b/test/functional/search_controller_test.rb
@@ -126,7 +126,7 @@ class SearchControllerTest < Test::Unit::TestCase
def test_quick_jump_to_issue
# issue of a public project
get :index, :q => "3"
- assert_redirected_to 'issues/show/3'
+ assert_redirected_to 'issues/3'
# issue of a private project
get :index, :q => "4"
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb
index 46c3f3ef8..a69a70ec0 100644
--- a/test/functional/timelog_controller_test.rb
+++ b/test/functional/timelog_controller_test.rb
@@ -377,6 +377,7 @@ class TimelogControllerTest < Test::Unit::TestCase
end
def test_details_all_projects_csv_export
+ Setting.date_format = '%m/%d/%Y'
get :details, :format => 'csv'
assert_response :success
assert_equal 'text/csv', @response.content_type
@@ -385,6 +386,7 @@ class TimelogControllerTest < Test::Unit::TestCase
end
def test_details_csv_export
+ Setting.date_format = '%m/%d/%Y'
get :details, :project_id => 1, :format => 'csv'
assert_response :success
assert_equal 'text/csv', @response.content_type
diff --git a/test/functional/welcome_controller_test.rb b/test/functional/welcome_controller_test.rb
index b45cb97c8..0376fd857 100644
--- a/test/functional/welcome_controller_test.rb
+++ b/test/functional/welcome_controller_test.rb
@@ -51,7 +51,7 @@ class WelcomeControllerTest < Test::Unit::TestCase
Setting.default_language = 'en'
@request.env['HTTP_ACCEPT_LANGUAGE'] = 'zh-TW'
get :index
- assert_equal :"zh-tw", @controller.current_language
+ assert_equal :"zh-TW", @controller.current_language
end
def test_browser_language_alternate_not_valid
diff --git a/test/functional/wikis_controller_test.rb b/test/functional/wikis_controller_test.rb
index 4000b1128..c558db0cb 100644
--- a/test/functional/wikis_controller_test.rb
+++ b/test/functional/wikis_controller_test.rb
@@ -63,7 +63,7 @@ class WikisControllerTest < Test::Unit::TestCase
def test_destroy
@request.session[:user_id] = 1
post :destroy, :id => 1, :confirm => 1
- assert_redirected_to :action => 'settings', :id => 'ecookbook', :tab => 'wiki'
+ assert_redirected_to :controller => 'projects', :action => 'settings', :id => 'ecookbook', :tab => 'wiki'
assert_nil Project.find(1).wiki
end