annotate test/functional/issues_controller_transaction_test.rb @ 892:f171d5dfaef0 bug_67

Close obsolete branch bug_67
author Chris Cannam
date Wed, 09 Feb 2011 12:16:25 +0000
parents 513646585e45
children af80e5618e9b
rev   line source
Chris@0 1 # Redmine - project management software
Chris@0 2 # Copyright (C) 2006-2010 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@0 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@0 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@0 18 require File.dirname(__FILE__) + '/../test_helper'
Chris@0 19 require 'issues_controller'
Chris@0 20
Chris@0 21 # Re-raise errors caught by the controller.
Chris@0 22 class IssuesController; def rescue_action(e) raise e end; end
Chris@0 23
Chris@0 24 class IssuesControllerTransactionTest < ActionController::TestCase
Chris@0 25 fixtures :projects,
Chris@0 26 :users,
Chris@0 27 :roles,
Chris@0 28 :members,
Chris@0 29 :member_roles,
Chris@0 30 :issues,
Chris@0 31 :issue_statuses,
Chris@0 32 :versions,
Chris@0 33 :trackers,
Chris@0 34 :projects_trackers,
Chris@0 35 :issue_categories,
Chris@0 36 :enabled_modules,
Chris@0 37 :enumerations,
Chris@0 38 :attachments,
Chris@0 39 :workflows,
Chris@0 40 :custom_fields,
Chris@0 41 :custom_values,
Chris@0 42 :custom_fields_projects,
Chris@0 43 :custom_fields_trackers,
Chris@0 44 :time_entries,
Chris@0 45 :journals,
Chris@0 46 :journal_details,
Chris@0 47 :queries
Chris@0 48
Chris@0 49 self.use_transactional_fixtures = false
Chris@0 50
Chris@0 51 def setup
Chris@0 52 @controller = IssuesController.new
Chris@0 53 @request = ActionController::TestRequest.new
Chris@0 54 @response = ActionController::TestResponse.new
Chris@0 55 User.current = nil
Chris@0 56 end
Chris@0 57
Chris@0 58 def test_put_update_stale_issue
Chris@0 59 issue = Issue.find(2)
Chris@0 60 @request.session[:user_id] = 2
Chris@0 61
Chris@0 62 assert_no_difference 'Journal.count' do
Chris@0 63 assert_no_difference 'TimeEntry.count' do
Chris@0 64 assert_no_difference 'Attachment.count' do
Chris@0 65 put :update,
Chris@0 66 :id => issue.id,
Chris@0 67 :issue => {
Chris@0 68 :fixed_version_id => 4,
Chris@0 69 :lock_version => (issue.lock_version - 1)
Chris@0 70 },
Chris@0 71 :notes => '',
Chris@0 72 :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}},
Chris@0 73 :time_entry => { :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id }
Chris@0 74 end
Chris@0 75 end
Chris@0 76 end
Chris@0 77
Chris@0 78 assert_response :success
Chris@0 79 assert_template 'edit'
Chris@0 80 assert_tag :tag => 'div', :attributes => { :id => 'errorExplanation' },
Chris@0 81 :content => /Data has been updated by another user/
Chris@0 82 end
Chris@0 83 end