annotate test/functional/issues_controller_transaction_test.rb @ 1082:997f6d7738f7 bug_531

In repo controller entry action, show the page for the file even if it's binary (so user still has access to history etc links). This makes it possible to use the entry action as the default when a file is clicked on
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 22 Nov 2012 18:04:17 +0000
parents cbb26bc654de
children 433d4f72a19b
rev   line source
Chris@0 1 # Redmine - project management software
Chris@909 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
Chris@0 3 #
Chris@0 4 # This program is free software; you can redistribute it and/or
Chris@0 5 # modify it under the terms of the GNU General Public License
Chris@0 6 # as published by the Free Software Foundation; either version 2
Chris@0 7 # of the License, or (at your option) any later version.
Chris@909 8 #
Chris@0 9 # This program is distributed in the hope that it will be useful,
Chris@0 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@0 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@0 12 # GNU General Public License for more details.
Chris@909 13 #
Chris@0 14 # You should have received a copy of the GNU General Public License
Chris@0 15 # along with this program; if not, write to the Free Software
Chris@0 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@0 17
Chris@119 18 require File.expand_path('../../test_helper', __FILE__)
Chris@0 19 require 'issues_controller'
Chris@0 20
Chris@0 21 class IssuesControllerTransactionTest < ActionController::TestCase
Chris@0 22 fixtures :projects,
Chris@0 23 :users,
Chris@0 24 :roles,
Chris@0 25 :members,
Chris@0 26 :member_roles,
Chris@0 27 :issues,
Chris@0 28 :issue_statuses,
Chris@0 29 :versions,
Chris@0 30 :trackers,
Chris@0 31 :projects_trackers,
Chris@0 32 :issue_categories,
Chris@0 33 :enabled_modules,
Chris@0 34 :enumerations,
Chris@0 35 :attachments,
Chris@0 36 :workflows,
Chris@0 37 :custom_fields,
Chris@0 38 :custom_values,
Chris@0 39 :custom_fields_projects,
Chris@0 40 :custom_fields_trackers,
Chris@0 41 :time_entries,
Chris@0 42 :journals,
Chris@0 43 :journal_details,
Chris@0 44 :queries
Chris@0 45
Chris@0 46 self.use_transactional_fixtures = false
Chris@909 47
Chris@0 48 def setup
Chris@0 49 @controller = IssuesController.new
Chris@0 50 @request = ActionController::TestRequest.new
Chris@0 51 @response = ActionController::TestResponse.new
Chris@0 52 User.current = nil
Chris@0 53 end
Chris@909 54
Chris@0 55 def test_put_update_stale_issue
Chris@0 56 issue = Issue.find(2)
Chris@0 57 @request.session[:user_id] = 2
Chris@0 58
Chris@0 59 assert_no_difference 'Journal.count' do
Chris@0 60 assert_no_difference 'TimeEntry.count' do
Chris@0 61 assert_no_difference 'Attachment.count' do
Chris@0 62 put :update,
Chris@0 63 :id => issue.id,
Chris@0 64 :issue => {
Chris@0 65 :fixed_version_id => 4,
Chris@0 66 :lock_version => (issue.lock_version - 1)
Chris@0 67 },
Chris@0 68 :notes => '',
Chris@0 69 :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}},
Chris@0 70 :time_entry => { :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id }
Chris@0 71 end
Chris@0 72 end
Chris@0 73 end
Chris@909 74
Chris@0 75 assert_response :success
Chris@0 76 assert_template 'edit'
Chris@0 77 assert_tag :tag => 'div', :attributes => { :id => 'errorExplanation' },
Chris@0 78 :content => /Data has been updated by another user/
Chris@0 79 end
Chris@0 80 end