Project

General

Profile

Patch #12659 ยป patch.diff

Vladimir Kiselev, 2012-12-20 16:44

View differences:

app/models/mailer.rb
54 54
  #   issue_edit(journal) => Mail::Message object
55 55
  #   Mailer.issue_edit(journal).deliver => sends an email to issue recipients
56 56
  def issue_edit(journal)
57
    issue = journal.journalized.reload
57
    issue = Issue.find(journal.journalized)
58 58
    redmine_headers 'Project' => issue.project.identifier,
59 59
                    'Issue-Id' => issue.id,
60 60
                    'Issue-Author' => issue.author.login
test/functional/issues_controller_test.rb
2691 2691
    assert_equal 'This is the test_new issue', issue.subject
2692 2692
  end
2693 2693

  
2694
  module IssueCallbackCheck
2695
    class << self
2696
      def included(base)
2697
        base.class_eval do
2698
          after_save :test_callback
2699
        end
2700
      end
2701
    end
2702

  
2703
    def test_callback
2704
      $dirty_tracking_failed = !subject_changed?
2705
    end
2706
  end
2707

  
2708
  def test_put_update_should_not_break_dirty_tracking
2709
    @request.session[:user_id] = 2
2710
    ActionMailer::Base.deliveries.clear
2711

  
2712
    $dirty_tracking_failed = true
2713

  
2714
    Issue.send(:include, IssueCallbackCheck)
2715

  
2716
    new_subject = "some_subject"
2717
    put :update, :id => 1, :issue => { :subject => new_subject }
2718

  
2719
    refute $dirty_tracking_failed
2720
  end
2721

  
2694 2722
  def test_put_update_without_custom_fields_param
2695 2723
    @request.session[:user_id] = 2
2696 2724
    ActionMailer::Base.deliveries.clear
    (1-1/1)