diff options
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/issues_controller_test.rb | 26 | ||||
-rw-r--r-- | test/functional/queries_controller_test.rb | 2 | ||||
-rw-r--r-- | test/functional/repositories_subversion_controller_test.rb | 14 | ||||
-rw-r--r-- | test/functional/time_entry_reports_controller_test.rb | 10 | ||||
-rw-r--r-- | test/functional/timelog_controller_test.rb | 12 | ||||
-rw-r--r-- | test/functional/watchers_controller_test.rb | 11 | ||||
-rw-r--r-- | test/functional/wiki_controller_test.rb | 6 |
7 files changed, 52 insertions, 29 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index adb7ebf2f..bf24ff368 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -318,7 +318,7 @@ class IssuesControllerTest < ActionController::TestCase get :index, :format => 'csv' assert_response :success assert_not_nil assigns(:issues) - assert_equal 'text/csv', @response.content_type + assert_equal 'text/csv; header=present', @response.content_type assert @response.body.starts_with?("#,") lines = @response.body.chomp.split("\n") assert_equal assigns(:query).columns.size + 1, lines[0].split(',').size @@ -328,14 +328,14 @@ class IssuesControllerTest < ActionController::TestCase get :index, :project_id => 1, :format => 'csv' assert_response :success assert_not_nil assigns(:issues) - assert_equal 'text/csv', @response.content_type + assert_equal 'text/csv; header=present', @response.content_type end def test_index_csv_with_description get :index, :format => 'csv', :description => '1' assert_response :success assert_not_nil assigns(:issues) - assert_equal 'text/csv', @response.content_type + assert_equal 'text/csv; header=present', @response.content_type assert @response.body.starts_with?("#,") lines = @response.body.chomp.split("\n") assert_equal assigns(:query).columns.size + 2, lines[0].split(',').size @@ -347,7 +347,7 @@ class IssuesControllerTest < ActionController::TestCase get :index, :format => 'csv', :set_filter => '1', :c => %w(subject spent_hours) assert_response :success - assert_equal 'text/csv', @response.content_type + assert_equal 'text/csv; header=present', @response.content_type lines = @response.body.chomp.split("\n") assert_include "#{issue.id},#{issue.subject},7.33", lines end @@ -356,7 +356,7 @@ class IssuesControllerTest < ActionController::TestCase get :index, :format => 'csv', :columns => 'all' assert_response :success assert_not_nil assigns(:issues) - assert_equal 'text/csv', @response.content_type + assert_equal 'text/csv; header=present', @response.content_type assert @response.body.starts_with?("#,") lines = @response.body.chomp.split("\n") assert_equal assigns(:query).available_columns.size + 1, lines[0].split(',').size @@ -391,7 +391,7 @@ class IssuesControllerTest < ActionController::TestCase :f => ['subject'], :op => '=', :values => [str_utf8], :format => 'csv' - assert_equal 'text/csv', @response.content_type + assert_equal 'text/csv; header=present', @response.content_type lines = @response.body.chomp.split("\n") s1 = "\xaa\xac\xbaA" if str_utf8.respond_to?(:force_encoding) @@ -419,7 +419,7 @@ class IssuesControllerTest < ActionController::TestCase :c => ['status', 'subject'], :format => 'csv', :set_filter => 1 - assert_equal 'text/csv', @response.content_type + assert_equal 'text/csv; header=present', @response.content_type lines = @response.body.chomp.split("\n") s1 = "\xaa\xac\xbaA" # status if str_utf8.respond_to?(:force_encoding) @@ -454,7 +454,7 @@ class IssuesControllerTest < ActionController::TestCase :c => ['estimated_hours', 'subject'], :format => 'csv', :set_filter => 1 - assert_equal 'text/csv', @response.content_type + assert_equal 'text/csv; header=present', @response.content_type lines = @response.body.chomp.split("\n") assert_equal "#{issue.id},1234.50,#{str1}", lines[1] @@ -483,7 +483,7 @@ class IssuesControllerTest < ActionController::TestCase :c => ['estimated_hours', 'subject'], :format => 'csv', :set_filter => 1 - assert_equal 'text/csv', @response.content_type + assert_equal 'text/csv; header=present', @response.content_type lines = @response.body.chomp.split("\n") assert_equal "#{issue.id};1234,50;#{str1}", lines[1] @@ -1357,7 +1357,7 @@ class IssuesControllerTest < ActionController::TestCase :attributes => {:name => 'issue[tracker_id]'}, :child => {:tag => 'option', :attributes => {:value => '3', :selected => 'selected'}} assert_tag 'textarea', - :attributes => {:name => 'issue[description]'}, :content => 'Prefilled' + :attributes => {:name => 'issue[description]'}, :content => "\nPrefilled" assert_tag 'input', :attributes => {:name => 'issue[custom_field_values][2]', :value => 'Custom field value'} end @@ -1727,7 +1727,7 @@ class IssuesControllerTest < ActionController::TestCase assert_template 'new' assert_tag :textarea, :attributes => { :name => 'issue[description]' }, - :content => 'This is a description' + :content => "\nThis is a description" assert_tag :select, :attributes => { :name => 'issue[priority_id]' }, :child => { :tag => 'option', :attributes => { :selected => 'selected', :value => '6' }, @@ -2621,7 +2621,7 @@ class IssuesControllerTest < ActionController::TestCase assert_template 'edit' assert_error_tag :descendant => {:content => /Activity can't be blank/} - assert_tag :textarea, :attributes => { :name => 'notes' }, :content => notes + assert_tag :textarea, :attributes => { :name => 'notes' }, :content => "\n"+notes assert_tag :input, :attributes => { :name => 'time_entry[hours]', :value => "2z" } end @@ -2640,7 +2640,7 @@ class IssuesControllerTest < ActionController::TestCase assert_error_tag :descendant => {:content => /Activity can't be blank/} assert_error_tag :descendant => {:content => /Hours can't be blank/} - assert_tag :textarea, :attributes => { :name => 'notes' }, :content => notes + assert_tag :textarea, :attributes => { :name => 'notes' }, :content => "\n"+notes assert_tag :input, :attributes => { :name => 'time_entry[comments]', :value => "this is my comment" } end diff --git a/test/functional/queries_controller_test.rb b/test/functional/queries_controller_test.rb index 5fc454388..fc509a241 100644 --- a/test/functional/queries_controller_test.rb +++ b/test/functional/queries_controller_test.rb @@ -140,7 +140,7 @@ class QueriesControllerTest < ActionController::TestCase def test_create_with_failure @request.session[:user_id] = 2 - assert_no_difference 'Query.count' do + assert_no_difference '::Query.count' do post :create, :project_id => 'ecookbook', :query => {:name => ''} end assert_response :success diff --git a/test/functional/repositories_subversion_controller_test.rb b/test/functional/repositories_subversion_controller_test.rb index 419d6dc39..4e9bde9d2 100644 --- a/test/functional/repositories_subversion_controller_test.rb +++ b/test/functional/repositories_subversion_controller_test.rb @@ -62,12 +62,26 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase entry = assigns(:entries).detect {|e| e.name == 'subversion_test'} assert_not_nil entry assert_equal 'dir', entry.kind + assert_select 'tr.dir a[href=/projects/subproject1/repository/show/subversion_test]' assert_tag 'input', :attributes => {:name => 'rev'} assert_tag 'a', :content => 'Statistics' assert_tag 'a', :content => 'Atom' end + def test_show_non_default + Repository::Subversion.create(:project => @project, + :url => self.class.subversion_repository_url, + :is_default => false, :identifier => 'svn') + + get :show, :id => PRJ_ID, :repository_id => 'svn' + assert_response :success + assert_template 'show' + assert_select 'tr.dir a[href=/projects/subproject1/repository/svn/show/subversion_test]' + # Repository menu should link to the main repo + assert_select '#main-menu a[href=/projects/subproject1/repository]' + end + def test_browse_directory assert_equal 0, @repository.changesets.count @repository.fetch_changesets diff --git a/test/functional/time_entry_reports_controller_test.rb b/test/functional/time_entry_reports_controller_test.rb index e4ea8b8ec..44a5037d8 100644 --- a/test/functional/time_entry_reports_controller_test.rb +++ b/test/functional/time_entry_reports_controller_test.rb @@ -136,7 +136,7 @@ class TimeEntryReportsControllerTest < ActionController::TestCase get :report, :columns => 'month', :from => "2007-01-01", :to => "2007-06-30", :criteria => ["project", "member", "activity"], :format => "csv" assert_response :success - assert_equal 'text/csv', @response.content_type + assert_equal 'text/csv; header=present', @response.content_type lines = @response.body.chomp.split("\n") # Headers assert_equal 'Project,Member,Activity,2007-1,2007-2,2007-3,2007-4,2007-5,2007-6,Total', @@ -150,7 +150,7 @@ class TimeEntryReportsControllerTest < ActionController::TestCase :from => "2007-01-01", :to => "2007-06-30", :criteria => ["project", "member", "activity"], :format => "csv" assert_response :success - assert_equal 'text/csv', @response.content_type + assert_equal 'text/csv; header=present', @response.content_type lines = @response.body.chomp.split("\n") # Headers assert_equal 'Project,Member,Activity,2007-1,2007-2,2007-3,2007-4,2007-5,2007-6,Total', @@ -188,7 +188,7 @@ class TimeEntryReportsControllerTest < ActionController::TestCase :from => "2011-11-11", :to => "2011-11-11", :criteria => ["member"], :format => "csv" assert_response :success - assert_equal 'text/csv', @response.content_type + assert_equal 'text/csv; header=present', @response.content_type lines = @response.body.chomp.split("\n") # Headers s1 = "\xa6\xa8\xad\xfb,2011-11-11,\xc1`\xadp" @@ -239,7 +239,7 @@ class TimeEntryReportsControllerTest < ActionController::TestCase :from => "2011-11-11", :to => "2011-11-11", :criteria => ["member"], :format => "csv" assert_response :success - assert_equal 'text/csv', @response.content_type + assert_equal 'text/csv; header=present', @response.content_type lines = @response.body.chomp.split("\n") # Headers s1 = "\xa6\xa8\xad\xfb,2011-11-11,\xc1`\xadp" @@ -280,7 +280,7 @@ class TimeEntryReportsControllerTest < ActionController::TestCase :from => "2011-11-11", :to => "2011-11-11", :criteria => ["member"], :format => "csv" assert_response :success - assert_equal 'text/csv', @response.content_type + assert_equal 'text/csv; header=present', @response.content_type lines = @response.body.chomp.split("\n") # Headers s1 = "Membre;2011-11-11;Total" diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb index 9fa9ae637..a314bd80b 100644 --- a/test/functional/timelog_controller_test.rb +++ b/test/functional/timelog_controller_test.rb @@ -561,7 +561,7 @@ class TimelogControllerTest < ActionController::TestCase Setting.date_format = '%m/%d/%Y' get :index, :format => 'csv' assert_response :success - assert_equal 'text/csv', @response.content_type + assert_equal 'text/csv; header=present', @response.content_type assert @response.body.include?("Date,User,Activity,Project,Issue,Tracker,Subject,Hours,Comment,Overtime\n") assert @response.body.include?("\n04/21/2007,redMine Admin,Design,eCookbook,3,Bug,Error 281 when updating a recipe,1.0,\"\",\"\"\n") end @@ -570,7 +570,7 @@ class TimelogControllerTest < ActionController::TestCase Setting.date_format = '%m/%d/%Y' get :index, :project_id => 1, :format => 'csv' assert_response :success - assert_equal 'text/csv', @response.content_type + assert_equal 'text/csv; header=present', @response.content_type assert @response.body.include?("Date,User,Activity,Project,Issue,Tracker,Subject,Hours,Comment,Overtime\n") assert @response.body.include?("\n04/21/2007,redMine Admin,Design,eCookbook,3,Bug,Error 281 when updating a recipe,1.0,\"\",\"\"\n") end @@ -616,7 +616,7 @@ class TimelogControllerTest < ActionController::TestCase get :index, :project_id => 1, :format => 'csv', :from => '2011-11-10', :to => '2011-11-10' assert_response :success - assert_equal 'text/csv', @response.content_type + assert_equal 'text/csv; header=present', @response.content_type ar = @response.body.chomp.split("\n") s1 = "\xa4\xe9\xb4\xc1" if str_utf8.respond_to?(:force_encoding) @@ -653,7 +653,7 @@ class TimelogControllerTest < ActionController::TestCase get :index, :project_id => 1, :format => 'csv', :from => '2011-11-10', :to => '2011-11-10' assert_response :success - assert_equal 'text/csv', @response.content_type + assert_equal 'text/csv; header=present', @response.content_type ar = @response.body.chomp.split("\n") s1 = "\xa4\xe9\xb4\xc1" if str_utf8.respond_to?(:force_encoding) @@ -690,7 +690,7 @@ class TimelogControllerTest < ActionController::TestCase get :index, :project_id => 1, :format => 'csv', :from => '2011-11-10', :to => '2011-11-10' assert_response :success - assert_equal 'text/csv', @response.content_type + assert_equal 'text/csv; header=present', @response.content_type ar = @response.body.chomp.split("\n") s2 = ar[1].split(",")[7] @@ -724,7 +724,7 @@ class TimelogControllerTest < ActionController::TestCase get :index, :project_id => 1, :format => 'csv', :from => '2011-11-10', :to => '2011-11-10' assert_response :success - assert_equal 'text/csv', @response.content_type + assert_equal 'text/csv; header=present', @response.content_type ar = @response.body.chomp.split("\n") s2 = ar[1].split(";")[7] diff --git a/test/functional/watchers_controller_test.rb b/test/functional/watchers_controller_test.rb index 9247b6631..e477af5e8 100644 --- a/test/functional/watchers_controller_test.rb +++ b/test/functional/watchers_controller_test.rb @@ -84,10 +84,19 @@ class WatchersControllerTest < ActionController::TestCase assert_select_rjs :replace_html, 'ajax-modal' end - def test_new_for_new_record + def test_new_for_new_record_with_id @request.session[:user_id] = 2 xhr :get, :new, :project_id => 1 assert_response :success + assert_equal Project.find(1), assigns(:project) + assert_select_rjs :replace_html, 'ajax-modal' + end + + def test_new_for_new_record_with_identifier + @request.session[:user_id] = 2 + xhr :get, :new, :project_id => 'ecookbook' + assert_response :success + assert_equal Project.find(1), assigns(:project) assert_select_rjs :replace_html, 'ajax-modal' end diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index 54a3f650d..ce0c8480f 100644 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -198,7 +198,7 @@ class WikiControllerTest < ActionController::TestCase assert_tag 'textarea', :attributes => { :name => 'content[text]' }, - :content => WikiPage.find_by_title('Another_page').content.text + :content => "\n"+WikiPage.find_by_title('Another_page').content.text end def test_edit_section @@ -213,7 +213,7 @@ class WikiControllerTest < ActionController::TestCase assert_tag 'textarea', :attributes => { :name => 'content[text]' }, - :content => section + :content => "\n"+section assert_tag 'input', :attributes => { :name => 'section', :type => 'hidden', :value => '2' } assert_tag 'input', @@ -294,7 +294,7 @@ class WikiControllerTest < ActionController::TestCase assert_template 'edit' assert_error_tag :descendant => {:content => /Comment is too long/} - assert_tag :tag => 'textarea', :attributes => {:id => 'content_text'}, :content => 'edited' + assert_tag :tag => 'textarea', :attributes => {:id => 'content_text'}, :content => "\nedited" assert_tag :tag => 'input', :attributes => {:id => 'content_version', :value => '1'} end |