##// END OF EJS Templates
Allow a default version to be set on the command line for incoming emails (#7346)....
Jean-Philippe Lang -
r14407:0df7fa714b42
parent child
Show More
@@ -62,7 +62,7 class MailHandler < ActionMailer::Base
62 62 # Use when receiving emails with rake tasks
63 63 def self.extract_options_from_env(env)
64 64 options = {:issue => {}}
65 %w(project status tracker category priority).each do |option|
65 %w(project status tracker category priority fixed_version).each do |option|
66 66 options[:issue][option.to_sym] = env[option] if env[option]
67 67 end
68 68 %w(allow_override unknown_user no_permission_check no_account_notice default_group project_from_subaddress).each do |option|
@@ -93,6 +93,7 class RedmineMailHandler
93 93 opts.on("-t", "--tracker TRACKER", "name of the target tracker") {|v| self.issue_attributes['tracker'] = v}
94 94 opts.on( "--category CATEGORY", "name of the target category") {|v| self.issue_attributes['category'] = v}
95 95 opts.on( "--priority PRIORITY", "name of the target priority") {|v| self.issue_attributes['priority'] = v}
96 opts.on( "--fixed-version VERSION","name of the target version") {|v| self.issue_attributes['fixed_version'] = v}
96 97 opts.on( "--private", "create new issues as private") {|v| self.issue_attributes['is_private'] = '1'}
97 98 opts.on("-o", "--allow-override ATTRS", "allow email content to set attributes values",
98 99 "ATTRS is a comma separated list of attributes",
@@ -64,6 +64,7 Issue attributes control options:
64 64 tracker=TRACKER name of the target tracker
65 65 category=CATEGORY name of the target category
66 66 priority=PRIORITY name of the target priority
67 fixed_version=VERSION name of the target version
67 68 private create new issues as private
68 69 allow_override=ATTRS allow email content to set attributes values
69 70 ATTRS is a comma separated list of attributes
@@ -129,6 +129,17 class MailHandlerTest < ActiveSupport::TestCase
129 129 assert_equal 'Support request', issue.tracker.name
130 130 end
131 131
132 def test_add_issue_with_default_version
133 # This email contains: 'Project: onlinestore'
134 issue = submit_email(
135 'ticket_on_given_project.eml',
136 :issue => {:fixed_version => 'Alpha'}
137 )
138 assert issue.is_a?(Issue)
139 assert !issue.new_record?
140 assert_equal 'Alpha', issue.reload.fixed_version.name
141 end
142
132 143 def test_add_issue_with_status_override
133 144 # This email contains: 'Project: onlinestore' and 'Status: Resolved'
134 145 issue = submit_email('ticket_on_given_project.eml', :allow_override => ['status'])
General Comments 0
You need to be logged in to leave comments. Login now