end
@issue.project = @project
+ @issue.author = User.current
# Tracker must be set before custom field values
@issue.tracker ||= @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id] || :first)
if @issue.tracker.nil?
@issue.watcher_user_ids = params[:issue]['watcher_user_ids']
end
end
- @issue.author = User.current
@priorities = IssuePriority.all
@allowed_statuses = @issue.new_statuses_allowed_to(User.current, true)
end
assert_not_nil issue
assert_nil issue.parent
end
+
+ def test_post_create_private
+ @request.session[:user_id] = 2
+
+ assert_difference 'Issue.count' do
+ post :create, :project_id => 1,
+ :issue => {:tracker_id => 1,
+ :subject => 'This is a private issue',
+ :is_private => '1'}
+ end
+ issue = Issue.first(:order => 'id DESC')
+ assert issue.is_private?
+ end
+
+ def test_post_create_private_with_set_own_issues_private_permission
+ role = Role.find(1)
+ role.remove_permission! :set_issues_private
+ role.add_permission! :set_own_issues_private
+
+ @request.session[:user_id] = 2
+
+ assert_difference 'Issue.count' do
+ post :create, :project_id => 1,
+ :issue => {:tracker_id => 1,
+ :subject => 'This is a private issue',
+ :is_private => '1'}
+ end
+ issue = Issue.first(:order => 'id DESC')
+ assert issue.is_private?
+ end
def test_post_create_should_send_a_notification
ActionMailer::Base.deliveries.clear