@@ -64,7 +64,7 class IssueTest < ActiveSupport::TestCase | |||||
64 | issue.reload |
|
64 | issue.reload | |
65 | assert_equal 'PostgreSQL', issue.custom_value_for(field).value |
|
65 | assert_equal 'PostgreSQL', issue.custom_value_for(field).value | |
66 | end |
|
66 | end | |
67 |
|
67 | |||
68 | def test_create_with_group_assignment |
|
68 | def test_create_with_group_assignment | |
69 | with_settings :issue_group_assignment => '1' do |
|
69 | with_settings :issue_group_assignment => '1' do | |
70 | assert Issue.new(:project_id => 2, :tracker_id => 1, :author_id => 1, :subject => 'Group assignment', :assigned_to_id => 11).save |
|
70 | assert Issue.new(:project_id => 2, :tracker_id => 1, :author_id => 1, :subject => 'Group assignment', :assigned_to_id => 11).save | |
@@ -588,12 +588,12 class IssueTest < ActiveSupport::TestCase | |||||
588 | # author is not a member of project anymore |
|
588 | # author is not a member of project anymore | |
589 | assert !copy.recipients.include?(copy.author.mail) |
|
589 | assert !copy.recipients.include?(copy.author.mail) | |
590 | end |
|
590 | end | |
591 |
|
591 | |||
592 | def test_recipients_should_include_the_assigned_group_members |
|
592 | def test_recipients_should_include_the_assigned_group_members | |
593 | group_member = User.generate_with_protected! |
|
593 | group_member = User.generate_with_protected! | |
594 | group = Group.generate! |
|
594 | group = Group.generate! | |
595 | group.users << group_member |
|
595 | group.users << group_member | |
596 |
|
596 | |||
597 | issue = Issue.find(12) |
|
597 | issue = Issue.find(12) | |
598 | issue.assigned_to = group |
|
598 | issue.assigned_to = group | |
599 | assert issue.recipients.include?(group_member.mail) |
|
599 | assert issue.recipients.include?(group_member.mail) | |
@@ -710,22 +710,22 class IssueTest < ActiveSupport::TestCase | |||||
710 | assert_equal 1, assignable_user_ids.select {|i| i == user_id}.length, "User #{user_id} appears more or less than once" |
|
710 | assert_equal 1, assignable_user_ids.select {|i| i == user_id}.length, "User #{user_id} appears more or less than once" | |
711 | end |
|
711 | end | |
712 | end |
|
712 | end | |
713 |
|
713 | |||
714 | context "with issue_group_assignment" do |
|
714 | context "with issue_group_assignment" do | |
715 | should "include groups" do |
|
715 | should "include groups" do | |
716 | issue = Issue.new(:project => Project.find(2)) |
|
716 | issue = Issue.new(:project => Project.find(2)) | |
717 |
|
717 | |||
718 | with_settings :issue_group_assignment => '1' do |
|
718 | with_settings :issue_group_assignment => '1' do | |
719 | assert_equal %w(Group User), issue.assignable_users.map {|a| a.class.name}.uniq.sort |
|
719 | assert_equal %w(Group User), issue.assignable_users.map {|a| a.class.name}.uniq.sort | |
720 | assert issue.assignable_users.include?(Group.find(11)) |
|
720 | assert issue.assignable_users.include?(Group.find(11)) | |
721 | end |
|
721 | end | |
722 | end |
|
722 | end | |
723 | end |
|
723 | end | |
724 |
|
724 | |||
725 | context "without issue_group_assignment" do |
|
725 | context "without issue_group_assignment" do | |
726 | should "not include groups" do |
|
726 | should "not include groups" do | |
727 | issue = Issue.new(:project => Project.find(2)) |
|
727 | issue = Issue.new(:project => Project.find(2)) | |
728 |
|
728 | |||
729 | with_settings :issue_group_assignment => '0' do |
|
729 | with_settings :issue_group_assignment => '0' do | |
730 | assert_equal %w(User), issue.assignable_users.map {|a| a.class.name}.uniq.sort |
|
730 | assert_equal %w(User), issue.assignable_users.map {|a| a.class.name}.uniq.sort | |
731 | assert !issue.assignable_users.include?(Group.find(11)) |
|
731 | assert !issue.assignable_users.include?(Group.find(11)) | |
@@ -783,23 +783,23 class IssueTest < ActiveSupport::TestCase | |||||
783 | assert_equal old_description, detail.old_value |
|
783 | assert_equal old_description, detail.old_value | |
784 | assert_equal new_description, detail.value |
|
784 | assert_equal new_description, detail.value | |
785 | end |
|
785 | end | |
786 |
|
786 | |||
787 | def test_blank_descriptions_should_not_be_journalized |
|
787 | def test_blank_descriptions_should_not_be_journalized | |
788 | IssueCustomField.delete_all |
|
788 | IssueCustomField.delete_all | |
789 | Issue.update_all("description = NULL", "id=1") |
|
789 | Issue.update_all("description = NULL", "id=1") | |
790 |
|
790 | |||
791 | i = Issue.find(1) |
|
791 | i = Issue.find(1) | |
792 | i.init_journal(User.find(2)) |
|
792 | i.init_journal(User.find(2)) | |
793 | i.subject = "blank description" |
|
793 | i.subject = "blank description" | |
794 | i.description = "\r\n" |
|
794 | i.description = "\r\n" | |
795 |
|
795 | |||
796 | assert_difference 'Journal.count', 1 do |
|
796 | assert_difference 'Journal.count', 1 do | |
797 | assert_difference 'JournalDetail.count', 1 do |
|
797 | assert_difference 'JournalDetail.count', 1 do | |
798 | i.save! |
|
798 | i.save! | |
799 | end |
|
799 | end | |
800 | end |
|
800 | end | |
801 | end |
|
801 | end | |
802 |
|
802 | |||
803 | def test_description_eol_should_be_normalized |
|
803 | def test_description_eol_should_be_normalized | |
804 | i = Issue.new(:description => "CR \r LF \n CRLF \r\n") |
|
804 | i = Issue.new(:description => "CR \r LF \n CRLF \r\n") | |
805 | assert_equal "CR \r\n LF \r\n CRLF \r\n", i.description |
|
805 | assert_equal "CR \r\n LF \r\n CRLF \r\n", i.description |
General Comments 0
You need to be logged in to leave comments.
Login now