Make sure that fields filled before tracker change are preserved.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11410 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2013-02-16 15:20:36 +00:00
parent d01fe87a67
commit 9dd8988638
1 changed files with 26 additions and 10 deletions

View File

@ -57,11 +57,17 @@ class Redmine::UiTest::IssuesTest < Redmine::UiTest::Base
end
def test_create_issue_with_form_update
field = IssueCustomField.create!(
field1 = IssueCustomField.create!(
:field_format => 'string',
:name => 'Form update CF',
:name => 'Field1',
:is_for_all => true,
:trackers => Tracker.find_all_by_name('Feature request')
:trackers => Tracker.find_all_by_id([1, 2])
)
field2 = IssueCustomField.create!(
:field_format => 'string',
:name => 'Field2',
:is_for_all => true,
:trackers => Tracker.find_all_by_id(2)
)
Role.non_member.add_permission! :add_issues
@ -69,20 +75,30 @@ class Redmine::UiTest::IssuesTest < Redmine::UiTest::Base
log_user('someone', 'foo')
visit '/projects/ecookbook/issues/new'
assert page.has_no_content?('Form update CF')
assert page.has_no_content?(field2.name)
assert page.has_content?(field1.name)
fill_in 'Subject', :with => 'new test issue'
# the custom field should show up when changing tracker
fill_in 'Subject', :with => 'New test issue'
fill_in 'Description', :with => 'New test issue description'
fill_in field1.name, :with => 'CF1 value'
select 'Low', :from => 'Priority'
# field2 should show up when changing tracker
select 'Feature request', :from => 'Tracker'
assert page.has_content?('Form update CF')
assert page.has_content?(field2.name)
assert page.has_content?(field1.name)
fill_in 'Form update', :with => 'CF value'
fill_in field2.name, :with => 'CF2 value'
assert_difference 'Issue.count' do
find('input[name=commit]').click
page.first(:button, 'Create').click
end
issue = Issue.order('id desc').first
assert_equal 'CF value', issue.custom_field_value(field)
assert_equal 'New test issue', issue.subject
assert_equal 'New test issue description', issue.description
assert_equal 'Low', issue.priority.name
assert_equal 'CF1 value', issue.custom_field_value(field1)
assert_equal 'CF2 value', issue.custom_field_value(field2)
end
def test_create_issue_with_watchers