Skip to content

Commit

Permalink
fix for a bug in mailer template causing sorting of backtrace
Browse files Browse the repository at this point in the history
  • Loading branch information
Patryk Peszko authored and XING Engineering Dudes committed Feb 27, 2010
1 parent e3b4475 commit 6f40e46
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
13 changes: 8 additions & 5 deletions app/views/notifications_mailer/notification.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ open in browser >> <%= project_stack_url(@stack.project, @stack) %> <<
------------------------------
<%= section %>
------------------------------
<% sorted_output(value).each do |array_with_data| %>
<%= "#{array_with_data.first}#{': ' + array_with_data.last.inspect if array_with_data.last}" -%>
<% end %>

<% end %>
<% if section == "backtrace" %>
<%= value.join("\n").to_yaml -%>
<% else %>
<% sorted_output(value).each do |array_with_data| %>
<%= "#{array_with_data.first}#{': ' + array_with_data.last.inspect if array_with_data.last}" -%>
<% end %>
<% end %>
<% end %>
1 change: 1 addition & 0 deletions config/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@
config.gem "authlogic"
config.gem "mislav-will_paginate", :lib => "will_paginate", :source => "http://gems.github.com"
config.gem "lukeredpath-simpleconfig", :lib => "simpleconfig"
config.gem "ruby-net-ldap", :lib => "net/ldap"
end
8 changes: 8 additions & 0 deletions test/unit/notifications_mailer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,12 @@ class NotificationsMailerTest < ActionMailer::TestCase
assert_match /http:\/\/example.com\/projects\/#{stack.project.id}\/stacks\/#{stack.id}/, email.body
end

test "backtrace should not be sorted" do
payload = { "backtrace" => ["b_line", "a_line"] }
notification = Factory.create(:notification, :payload => ActiveSupport::JSON.encode(payload))

email = NotificationsMailer.deliver_notification(notification.stack)
assert_match /b_line\n.*a_line/, email.body
end

end

0 comments on commit 6f40e46

Please sign in to comment.