Hello community,
here is the log from the commit of package rubygem-exception_notification for openSUSE:Factory checked in at 2015-06-16 14:05:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-exception_notification (Old)
and /work/SRC/openSUSE:Factory/.rubygem-exception_notification.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-exception_notification"
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-exception_notification/rubygem-exception_notification.changes 2015-04-12 00:11:07.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.rubygem-exception_notification.new/rubygem-exception_notification.changes 2015-06-16 14:06:08.000000000 +0200
@@ -1,0 +2,12 @@
+Wed Jun 10 04:31:48 UTC 2015 - coolo@suse.com
+
+- updated to version 4.1.1
+ see installed CHANGELOG.rdoc
+
+ == 4.1.1
+
+ * bug fixes
+ * Alternate way to monkeypatch (by @joshco)
+ * Fix BacktraceCleaner namespacing (by @esdlocomb)
+
+-------------------------------------------------------------------
Old:
----
exception_notification-4.1.0.gem
New:
----
exception_notification-4.1.1.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-exception_notification.spec ++++++
--- /var/tmp/diff_new_pack.CozSOQ/_old 2015-06-16 14:06:09.000000000 +0200
+++ /var/tmp/diff_new_pack.CozSOQ/_new 2015-06-16 14:06:09.000000000 +0200
@@ -24,7 +24,7 @@
#
Name: rubygem-exception_notification
-Version: 4.1.0
+Version: 4.1.1
Release: 0
%define mod_name exception_notification
%define mod_full_name %{mod_name}-%{version}
++++++ exception_notification-4.1.0.gem -> exception_notification-4.1.1.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG.rdoc new/CHANGELOG.rdoc
--- old/CHANGELOG.rdoc 2015-04-06 00:31:20.000000000 +0200
+++ new/CHANGELOG.rdoc 2015-06-09 16:51:23.000000000 +0200
@@ -1,3 +1,9 @@
+== 4.1.1
+
+* bug fixes
+ * Alternate way to monkeypatch (by @joshco)
+ * Fix BacktraceCleaner namespacing (by @esdlocomb)
+
== 4.1.0
* enhancements
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Gemfile.lock new/Gemfile.lock
--- old/Gemfile.lock 2015-04-06 00:31:20.000000000 +0200
+++ new/Gemfile.lock 2015-06-09 16:51:23.000000000 +0200
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- exception_notification (4.1.0)
+ exception_notification (4.1.1)
actionmailer (>= 3.0.4)
activesupport (>= 3.0.4)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md
--- old/README.md 2015-04-06 00:31:20.000000000 +0200
+++ new/README.md 2015-06-09 16:51:23.000000000 +0200
@@ -39,9 +39,9 @@
As of Rails 3 ExceptionNotification is used as a rack middleware, or in the environment you want it to run. In most cases you would want ExceptionNotification to run on production. Thus, you can make it work by putting the following lines in your `config/environments/production.rb`:
```ruby
-Whatever::Application.config.middleware.use ExceptionNotification::Rack,
+Rails.application.config.middleware.use ExceptionNotification::Rack,
:email => {
- :email_prefix => "[Whatever] ",
+ :email_prefix => "[PREFIX] ",
:sender_address => %{"notifier" },
:exception_recipients => %w{exceptions@example.com}
}
@@ -58,8 +58,8 @@
As of 4.x version the configuration syntax has changed. All email related options MUST BE nested under the `:email` key. Thus, previous configuration like:
```ruby
-Whatever::Application.config.middleware.use ExceptionNotifier,
- :email_prefix => "[Whatever] ",
+Rails.application.config.middleware.use ExceptionNotifier,
+ :email_prefix => "[PREFIX] ",
:sender_address => %{"notifier" },
:exception_recipients => %w{exceptions@example.com}
```
@@ -67,9 +67,9 @@
becomes:
```ruby
-Whatever::Application.config.middleware.use ExceptionNotification::Rack,
+Rails.application.config.middleware.use ExceptionNotification::Rack,
:email => {
- :email_prefix => "[Whatever] ",
+ :email_prefix => "[PREFIX] ",
:sender_address => %{"notifier" },
:exception_recipients => %w{exceptions@example.com}
}
@@ -145,9 +145,9 @@
describe application-specific data--just add the section's name to the list (wherever you'd like), and define the corresponding partial. Like the following example with two new added sections:
```ruby
-Whatever::Application.config.middleware.use ExceptionNotification::Rack,
+Rails.application.config.middleware.use ExceptionNotification::Rack,
:email => {
- :email_prefix => "[Whatever] ",
+ :email_prefix => "[PREFIX] ",
:sender_address => %{"notifier" },
:exception_recipients => %w{exceptions@example.com},
:sections => %w{my_section1 my_section2}
@@ -183,9 +183,9 @@
When using [background notifications](#background-notifications) some variables are not available in the views, like `@kontroller` and `@request`. Thus, you may want to include different sections for background notifications:
```ruby
-Whatever::Application.config.middleware.use ExceptionNotification::Rack,
+Rails.application.config.middleware.use ExceptionNotification::Rack,
:email => {
- :email_prefix => "[Whatever] ",
+ :email_prefix => "[PREFIX] ",
:sender_address => %{"notifier" },
:exception_recipients => %w{exceptions@example.com},
:background_sections => %w{my_section1 my_section2 backtrace data}
@@ -200,9 +200,9 @@
Additionally, you may want to set customized headers on the outcoming emails. To do so, simply use the `:email_headers` option:
```ruby
-Whatever::Application.config.middleware.use ExceptionNotification::Rack,
+Rails.application.config.middleware.use ExceptionNotification::Rack,
:email => {
- :email_prefix => "[Whatever] ",
+ :email_prefix => "[PREFIX] ",
:sender_address => %{"notifier" },
:exception_recipients => %w{exceptions@example.com},
:email_headers => { "X-Custom-Header" => "foobar" }
@@ -238,9 +238,9 @@
By default, ExceptionNotification sends emails using the ActionMailer configuration of the application. In order to send emails by another delivery method, use the `delivery_method` option:
```ruby
-Whatever::Application.config.middleware.use ExceptionNotification::Rack,
+Rails.application.config.middleware.use ExceptionNotification::Rack,
:email => {
- :email_prefix => "[Whatever] ",
+ :email_prefix => "[PREFIX] ",
:sender_address => %{"notifier" },
:exception_recipients => %w{exceptions@example.com},
:delivery_method => :postmark,
@@ -253,9 +253,9 @@
Besides the `delivery_method` option, you also can customize the mailer settings by passing a hash under an option named `DELIVERY_METHOD_settings`. Thus, you can use override specific SMTP settings for notifications using:
```ruby
-Whatever::Application.config.middleware.use ExceptionNotification::Rack,
+Rails.application.config.middleware.use ExceptionNotification::Rack,
:email => {
- :email_prefix => "[Whatever] ",
+ :email_prefix => "[PREFIX] ",
:sender_address => %{"notifier" },
:exception_recipients => %w{exceptions@example.com},
:delivery_method => :smtp,
@@ -291,9 +291,9 @@
To configure it, you need to set the `subdomain`, `token` and `room_name` options, like this:
```ruby
-Whatever::Application.config.middleware.use ExceptionNotification::Rack,
+Rails.application.config.middleware.use ExceptionNotification::Rack,
:email => {
- :email_prefix => "[Whatever] ",
+ :email_prefix => "[PREFIX] ",
:sender_address => %{"notifier" },
:exception_recipients => %w{exceptions@example.com}
},
@@ -343,9 +343,9 @@
To configure it, you need to set the `token` and `room_name` options, like this:
```ruby
-Whatever::Application.config.middleware.use ExceptionNotification::Rack,
+Rails.application.config.middleware.use ExceptionNotification::Rack,
:email => {
- :email_prefix => "[Whatever] ",
+ :email_prefix => "[PREFIX] ",
:sender_address => %{"notifier" },
:exception_recipients => %w{exceptions@example.com}
},
@@ -404,9 +404,9 @@
To configure it, you need to set the `url` option, like this:
```ruby
-Whatever::Application.config.middleware.use ExceptionNotification::Rack,
+Rails.application.config.middleware.use ExceptionNotification::Rack,
:email => {
- :email_prefix => "[Whatever] ",
+ :email_prefix => "[PREFIX] ",
:sender_address => %{"notifier" },
:exception_recipients => %w{exceptions@example.com}
},
@@ -418,9 +418,9 @@
By default, the WebhookNotifier will call the URLs using the POST method. But, you can change this using the `http_method` option.
```ruby
-Whatever::Application.config.middleware.use ExceptionNotification::Rack,
+Rails.application.config.middleware.use ExceptionNotification::Rack,
:email => {
- :email_prefix => "[Whatever] ",
+ :email_prefix => "[PREFIX] ",
:sender_address => %{"notifier" },
:exception_recipients => %w{exceptions@example.com}
},
@@ -433,9 +433,9 @@
Besides the `url` and `http_method` options, all the other options are passed directly to HTTParty. Thus, if the HTTP server requires authentication, you can include the following options:
```ruby
-Whatever::Application.config.middleware.use ExceptionNotification::Rack,
+Rails.application.config.middleware.use ExceptionNotification::Rack,
:email => {
- :email_prefix => "[Whatever] ",
+ :email_prefix => "[PREFIX] ",
:sender_address => %{"notifier" },
:exception_recipients => %w{exceptions@example.com}
},
@@ -465,9 +465,9 @@
To configure it, you need to set at least the 'domain' option, like this:
```ruby
-Whatever::Application.config.middleware.use ExceptionNotification::Rack,
+Rails.application.config.middleware.use ExceptionNotification::Rack,
:email => {
- :email_prefix => "[Whatever] ",
+ :email_prefix => "[PREFIX] ",
:sender_address => %{"notifier" },
:exception_recipients => %w{exceptions@example.com}
},
@@ -479,7 +479,7 @@
There are several other options, which are described below. For example, to use ssl and a password, add a prefix, post to the '#log' channel, and include recipients in the message (so that they will be notified), your configuration might look like this:
```ruby
-Whatever::Application.config.middleware.use ExceptionNotification::Rack,
+Rails.application.config.middleware.use ExceptionNotification::Rack,
:irc => {
:domain => 'irc.example.com',
:nick => 'BadNewsBot',
@@ -564,9 +564,9 @@
To configure it, you need to set at least the 'webhook_url' option, like this:
```ruby
-Whatever::Application.config.middleware.use ExceptionNotification::Rack,
+Rails.application.config.middleware.use ExceptionNotification::Rack,
:email => {
- :email_prefix => "[Whatever] ",
+ :email_prefix => "[PREFIX] ",
:sender_address => %{"notifier" },
:exception_recipients => %w{exceptions@example.com}
},
@@ -583,7 +583,7 @@
The slack notification will include any data saved under `env["exception_notifier.exception_data"]`. If you find this too verbose, you can determine to exclude certain information by doing the following:
```ruby
-Whatever::Application.config.middleware.use ExceptionNotification::Rack,
+Rails.application.config.middleware.use ExceptionNotification::Rack,
:slack => {
:webhook_url => "[Your webhook url]",
:channel => "#exceptions",
@@ -664,9 +664,9 @@
Using it:
```ruby
-Whatever::Application.config.middleware.use ExceptionNotification::Rack,
+Rails.application.config.middleware.use ExceptionNotification::Rack,
:email => {
- :email_prefix => "[Whatever] ",
+ :email_prefix => "[PREFIX] ",
:sender_address => %{"notifier" },
:exception_recipients => %w{exceptions@example.com}
},
@@ -694,10 +694,10 @@
Ignore specified exception types. To achieve that, you should use the `:ignore_exceptions` option, like this:
```ruby
-Whatever::Application.config.middleware.use ExceptionNotification::Rack,
+Rails.application.config.middleware.use ExceptionNotification::Rack,
:ignore_exceptions => ['ActionView::TemplateError'] + ExceptionNotifier.ignored_exceptions,
:email => {
- :email_prefix => "[Whatever] ",
+ :email_prefix => "[PREFIX] ",
:sender_address => %{"notifier" },
:exception_recipients => %w{exceptions@example.com}
}
@@ -712,10 +712,10 @@
In some cases you may want to avoid getting notifications from exceptions made by crawlers. To prevent sending those unwanted notifications, use the `:ignore_crawlers` option like this:
```ruby
-Whatever::Application.config.middleware.use ExceptionNotification::Rack,
+Rails.application.config.middleware.use ExceptionNotification::Rack,
:ignore_crawlers => %w{Googlebot bingbot},
:email => {
- :email_prefix => "[Whatever] ",
+ :email_prefix => "[PREFIX] ",
:sender_address => %{"notifier" },
:exception_recipients => %w{exceptions@example.com}
}
@@ -728,10 +728,10 @@
Last but not least, you can ignore exceptions based on a condition. Take a look:
```ruby
-Whatever::Application.config.middleware.use ExceptionNotification::Rack,
+Rails.application.config.middleware.use ExceptionNotification::Rack,
:ignore_if => ->(env, exception) { exception.message =~ /^Couldn't find Page with ID=/ },
:email => {
- :email_prefix => "[Whatever] ",
+ :email_prefix => "[PREFIX] ",
:sender_address => %{"notifier" },
:exception_recipients => %w{exceptions@example.com},
}
Files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/exception_notification.gemspec new/exception_notification.gemspec
--- old/exception_notification.gemspec 2015-04-06 00:31:20.000000000 +0200
+++ new/exception_notification.gemspec 2015-06-09 16:51:23.000000000 +0200
@@ -1,8 +1,8 @@
Gem::Specification.new do |s|
s.name = 'exception_notification'
- s.version = '4.1.0'
+ s.version = '4.1.1'
s.authors = ["Jamis Buck", "Josh Peek"]
- s.date = %q{2015-04-05}
+ s.date = %q{2015-06-09}
s.summary = "Exception notification for Rails apps"
s.homepage = "http://smartinez87.github.com/exception_notification"
s.email = "smartinez87@gmail.com"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/exception_notifier/email_notifier.rb new/lib/exception_notifier/email_notifier.rb
--- old/lib/exception_notifier/email_notifier.rb 2015-04-06 00:31:20.000000000 +0200
+++ new/lib/exception_notifier/email_notifier.rb 2015-06-09 16:51:23.000000000 +0200
@@ -17,7 +17,7 @@
def self.extended(base)
base.class_eval do
- base.include BacktraceCleaner
+ self.send(:include, ExceptionNotifier::BacktraceCleaner)
# Append application view path to the ExceptionNotifier lookup context.
self.append_view_path "#{File.dirname(__FILE__)}/views"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/exception_notifier/modules/backtrace_cleaner.rb new/lib/exception_notifier/modules/backtrace_cleaner.rb
--- old/lib/exception_notifier/modules/backtrace_cleaner.rb 2015-04-06 00:31:20.000000000 +0200
+++ new/lib/exception_notifier/modules/backtrace_cleaner.rb 2015-06-09 16:51:23.000000000 +0200
@@ -1,11 +1,13 @@
-module BacktraceCleaner
+module ExceptionNotifier
+ module BacktraceCleaner
- def clean_backtrace(exception)
- if defined?(Rails) && Rails.respond_to?(:backtrace_cleaner)
- Rails.backtrace_cleaner.send(:filter, exception.backtrace)
- else
- exception.backtrace
+ def clean_backtrace(exception)
+ if defined?(Rails) && Rails.respond_to?(:backtrace_cleaner)
+ Rails.backtrace_cleaner.send(:filter, exception.backtrace)
+ else
+ exception.backtrace
+ end
end
- end
+ end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/exception_notifier/slack_notifier.rb new/lib/exception_notifier/slack_notifier.rb
--- old/lib/exception_notifier/slack_notifier.rb 2015-04-06 00:31:20.000000000 +0200
+++ new/lib/exception_notifier/slack_notifier.rb 2015-06-09 16:51:23.000000000 +0200
@@ -1,6 +1,6 @@
module ExceptionNotifier
class SlackNotifier
- include BacktraceCleaner
+ include ExceptionNotifier::BacktraceCleaner
attr_accessor :notifier
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2015-04-06 00:31:20.000000000 +0200
+++ new/metadata 2015-06-09 16:51:23.000000000 +0200
@@ -1,7 +1,7 @@
--- !ruby/object:Gem::Specification
name: exception_notification
version: !ruby/object:Gem::Version
- version: 4.1.0
+ version: 4.1.1
platform: ruby
authors:
- Jamis Buck
@@ -9,7 +9,7 @@
autorequire:
bindir: bin
cert_chain: []
-date: 2015-04-05 00:00:00.000000000 Z
+date: 2015-06-09 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: actionmailer
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/dummy/test/functional/posts_controller_test.rb new/test/dummy/test/functional/posts_controller_test.rb
--- old/test/dummy/test/functional/posts_controller_test.rb 2015-04-06 00:31:21.000000000 +0200
+++ new/test/dummy/test/functional/posts_controller_test.rb 2015-06-09 16:51:23.000000000 +0200
@@ -14,59 +14,59 @@
end
test "should have raised an exception" do
- assert_not_nil @exception
+ refute_nil @exception
end
test "should have generated a notification email" do
- assert_not_nil @mail
+ refute_nil @mail
end
test "mail should be plain text and UTF-8 enconded by default" do
- assert @mail.content_type == "text/plain; charset=UTF-8"
+ assert_equal @mail.content_type, "text/plain; charset=UTF-8"
end
test "mail should have a from address set" do
- assert @mail.from == ["dummynotifier@example.com"]
+ assert_equal @mail.from, ["dummynotifier@example.com"]
end
test "mail should have a to address set" do
- assert @mail.to == ["dummyexceptions@example.com"]
+ assert_equal @mail.to, ["dummyexceptions@example.com"]
end
test "mail subject should have the proper prefix" do
- assert @mail.subject.include? "[Dummy ERROR]"
+ assert_includes @mail.subject, "[Dummy ERROR]"
end
test "mail subject should include descriptive error message" do
- assert @mail.subject.include? "(NoMethodError) \"undefined method `nw'"
+ assert_includes @mail.subject, "(NoMethodError) \"undefined method `nw'"
end
test "mail should contain backtrace in body" do
- assert @mail.encoded.include? "`method_missing'\r\n app/controllers/posts_controller.rb:18:in `create'\r\n"
+ assert_includes @mail.encoded, "`method_missing'\r\n app/controllers/posts_controller.rb:18:in `create'\r\n"
end
test "mail should contain timestamp of exception in body" do
- assert @mail.encoded.include? "Timestamp : #{Time.current}"
+ assert_includes @mail.encoded, "Timestamp : #{Time.current}"
end
test "mail should contain the newly defined section" do
- assert @mail.encoded.include? "* New text section for testing"
+ assert_includes @mail.encoded, "* New text section for testing"
end
test "mail should contain the custom message" do
- assert @mail.encoded.include? "My Custom Message"
+ assert_includes @mail.encoded, "My Custom Message"
end
test "should filter sensible data" do
- assert @mail.encoded.include? "secret\"=>\"[FILTERED]"
+ assert_includes @mail.encoded, "secret\"=>\"[FILTERED]"
end
test "mail should contain the custom header" do
- assert @mail.encoded.include? 'X-Custom-Header: foobar'
+ assert_includes @mail.encoded, 'X-Custom-Header: foobar'
end
test "mail should not contain any attachments" do
- assert @mail.attachments == []
+ assert_equal @mail.attachments, []
end
test "should not send notification if one of ignored exceptions" do
@@ -79,7 +79,7 @@
end
end
- assert @ignored_exception.class.inspect == "ActiveRecord::RecordNotFound"
+ assert_equal @ignored_exception.class.inspect, "ActiveRecord::RecordNotFound"
assert_nil @ignored_mail
end
@@ -93,7 +93,7 @@
end
assert request.ssl?
- assert @secured_mail.encoded.include? "* session id: [FILTERED]\r\n *"
+ assert_includes @secured_mail.encoded, "* session id: [FILTERED]\r\n *"
end
test "should ignore exception if from unwanted crawler" do
@@ -127,7 +127,7 @@
@mail = @email_notifier.create_email(@exception, {:env => custom_env})
end
- assert @mail.content_type.include? "multipart/alternative"
+ assert_includes @mail.content_type, "multipart/alternative"
end
end
@@ -219,6 +219,6 @@
end
test "mail should contain the specified section" do
- assert @mail.encoded.include? "* New background section for testing"
+ assert_includes @mail.encoded, "* New background section for testing"
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/exception_notifier/campfire_notifier_test.rb new/test/exception_notifier/campfire_notifier_test.rb
--- old/test/exception_notifier/campfire_notifier_test.rb 2015-04-06 00:31:21.000000000 +0200
+++ new/test/exception_notifier/campfire_notifier_test.rb 2015-06-09 16:51:23.000000000 +0200
@@ -11,9 +11,9 @@
assert !notif[:message].empty?
assert_equal notif[:message][:type], 'PasteMessage'
- assert notif[:message][:body].include? "A new exception occurred:"
- assert notif[:message][:body].include? "divided by 0"
- assert notif[:message][:body].include? "/exception_notification/test/campfire_test.rb:45"
+ assert_includes notif[:message][:body], "A new exception occurred:"
+ assert_includes notif[:message][:body], "divided by 0"
+ assert_includes notif[:message][:body], "/exception_notification/test/campfire_test.rb:45"
end
test "should not send campfire notification if badly configured" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/exception_notifier/email_notifier_test.rb new/test/exception_notifier/email_notifier_test.rb
--- old/test/exception_notifier/email_notifier_test.rb 2015-04-06 00:31:21.000000000 +0200
+++ new/test/exception_notifier/email_notifier_test.rb 2015-06-09 16:51:23.000000000 +0200
@@ -14,59 +14,59 @@
end
test "should have default sender address overridden" do
- assert @email_notifier.sender_address == %("Dummy Notifier" )
+ assert_equal @email_notifier.sender_address, %("Dummy Notifier" )
end
test "should have default exception recipients overridden" do
- assert @email_notifier.exception_recipients == %w(dummyexceptions@example.com)
+ assert_equal @email_notifier.exception_recipients, %w(dummyexceptions@example.com)
end
test "should have default email prefix overridden" do
- assert @email_notifier.email_prefix == "[Dummy ERROR] "
+ assert_equal @email_notifier.email_prefix, "[Dummy ERROR] "
end
test "should have default email headers overridden" do
- assert @email_notifier.email_headers == { "X-Custom-Header" => "foobar"}
+ assert_equal @email_notifier.email_headers, { "X-Custom-Header" => "foobar"}
end
test "should have default sections overridden" do
for section in %w(new_section request session environment backtrace)
- assert @email_notifier.sections.include? section
+ assert_includes @email_notifier.sections, section
end
end
test "should have default background sections" do
for section in %w(new_bkg_section backtrace data)
- assert @email_notifier.background_sections.include? section
+ assert_includes @email_notifier.background_sections, section
end
end
test "should have email format by default" do
- assert @email_notifier.email_format == :text
+ assert_equal @email_notifier.email_format, :text
end
test "should have verbose subject by default" do
- assert @email_notifier.verbose_subject == true
+ assert @email_notifier.verbose_subject
end
test "should have normalize_subject false by default" do
- assert @email_notifier.normalize_subject == false
+ refute @email_notifier.normalize_subject
end
test "should have delivery_method nil by default" do
- assert @email_notifier.delivery_method == nil
+ assert_nil @email_notifier.delivery_method
end
test "should have mailer_settings nil by default" do
- assert @email_notifier.mailer_settings == nil
+ assert_nil @email_notifier.mailer_settings
end
test "should have mailer_parent by default" do
- assert @email_notifier.mailer_parent == 'ActionMailer::Base'
+ assert_equal @email_notifier.mailer_parent, 'ActionMailer::Base'
end
test "should have template_path by default" do
- assert @email_notifier.template_path == 'exception_notifier'
+ assert_equal @email_notifier.template_path, 'exception_notifier'
end
test "should normalize multiple digits into one N" do
@@ -75,31 +75,39 @@
end
test "mail should be plain text and UTF-8 enconded by default" do
- assert @mail.content_type == "text/plain; charset=UTF-8"
+ assert_equal @mail.content_type, "text/plain; charset=UTF-8"
end
test "should have raised an exception" do
- assert_not_nil @exception
+ refute_nil @exception
end
test "should have generated a notification email" do
- assert_not_nil @mail
+ refute_nil @mail
end
test "mail should have a from address set" do
- assert @mail.from == ["dummynotifier@example.com"]
+ assert_equal @mail.from, ["dummynotifier@example.com"]
end
test "mail should have a to address set" do
- assert @mail.to == ["dummyexceptions@example.com"]
+ assert_equal @mail.to, ["dummyexceptions@example.com"]
end
test "mail should have a descriptive subject" do
- assert @mail.subject == "[Dummy ERROR] (ZeroDivisionError) \"divided by 0\""
+ # On Rails < 4.1 the subject prefix has two spaces before the rest of the
+ # subject content.
+ if Gem::Version.new(ActionMailer::VERSION::STRING) < Gem::Version.new('4.1')
+ prefix = '[Dummy ERROR] '
+ else
+ # On Rails 4.1 the subject prefix has a single space.
+ prefix = '[Dummy ERROR] '
+ end
+ assert_equal @mail.subject, prefix + '(ZeroDivisionError) "divided by 0"'
end
test "mail should say exception was raised in background at show timestamp" do
- assert @mail.encoded.include? "A ZeroDivisionError occurred in background at #{Time.current}"
+ assert_includes @mail.encoded, "A ZeroDivisionError occurred in background at #{Time.current}"
end
test "mail should prefix exception class with 'an' instead of 'a' when it starts with a vowel" do
@@ -110,7 +118,7 @@
@vowel_mail = @email_notifier.create_email(@vowel_exception)
end
- assert @vowel_mail.encoded.include? "An ActiveRecord::RecordNotFound occurred in background at #{Time.current}"
+ assert_includes @vowel_mail.encoded, "An ActiveRecord::RecordNotFound occurred in background at #{Time.current}"
end
test "mail should contain backtrace in body" do
@@ -118,14 +126,14 @@
end
test "mail should contain data in body" do
- assert @mail.encoded.include? '* data:'
- assert @mail.encoded.include? ':payload=>"1/0"'
- assert @mail.encoded.include? ':job=>"DivideWorkerJob"'
- assert @mail.encoded.include? "My Custom Message"
+ assert_includes @mail.encoded, '* data:'
+ assert_includes @mail.encoded, ':payload=>"1/0"'
+ assert_includes @mail.encoded, ':job=>"DivideWorkerJob"'
+ assert_includes @mail.encoded, "My Custom Message"
end
test "mail should not contain any attachments" do
- assert @mail.attachments == []
+ assert_equal @mail.attachments, []
end
test "should not send notification if one of ignored exceptions" do
@@ -138,7 +146,7 @@
end
end
- assert @ignored_exception.class.inspect == "ActiveRecord::RecordNotFound"
+ assert_equal @ignored_exception.class.inspect, "ActiveRecord::RecordNotFound"
assert_nil @ignored_mail
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/exception_notifier/webhook_notifier_test.rb new/test/exception_notifier/webhook_notifier_test.rb
--- old/test/exception_notifier/webhook_notifier_test.rb 2015-04-06 00:31:21.000000000 +0200
+++ new/test/exception_notifier/webhook_notifier_test.rb 2015-06-09 16:51:23.000000000 +0200
@@ -9,11 +9,11 @@
webhook.stubs(:call).returns(fake_response)
response = webhook.call(fake_exception)
- assert_not_nil response
+ refute_nil response
assert_equal response[:status], 200
assert_equal response[:body][:exception][:error_class], "ZeroDivisionError"
- assert response[:body][:exception][:message].include? "divided by 0"
- assert response[:body][:exception][:backtrace].include? "/exception_notification/test/webhook_notifier_test.rb:48"
+ assert_includes response[:body][:exception][:message], "divided by 0"
+ assert_includes response[:body][:exception][:backtrace], "/exception_notification/test/webhook_notifier_test.rb:48"
assert response[:body][:request][:cookies].has_key?(:cookie_item1)
assert_equal response[:body][:request][:url], "http://example.com/example"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/exception_notifier_test.rb new/test/exception_notifier_test.rb
--- old/test/exception_notifier_test.rb 2015-04-06 00:31:21.000000000 +0200
+++ new/test/exception_notifier_test.rb 2015-06-09 16:51:23.000000000 +0200
@@ -2,18 +2,18 @@
class ExceptionNotifierTest < ActiveSupport::TestCase
test "should have default ignored exceptions" do
- assert ExceptionNotifier.ignored_exceptions == ['ActiveRecord::RecordNotFound', 'AbstractController::ActionNotFound', 'ActionController::RoutingError', 'ActionController::UnknownFormat']
+ assert_equal ExceptionNotifier.ignored_exceptions, ['ActiveRecord::RecordNotFound', 'AbstractController::ActionNotFound', 'ActionController::RoutingError', 'ActionController::UnknownFormat']
end
test "should have email notifier registered" do
- assert ExceptionNotifier.notifiers == [:email]
+ assert_equal ExceptionNotifier.notifiers, [:email]
end
test "should have a valid email notifier" do
@email_notifier = ExceptionNotifier.registered_exception_notifier(:email)
- assert_not_nil @email_notifier
- assert @email_notifier.class == ExceptionNotifier::EmailNotifier
- assert @email_notifier.respond_to?(:call)
+ refute_nil @email_notifier
+ assert_equal @email_notifier.class, ExceptionNotifier::EmailNotifier
+ assert_respond_to @email_notifier, :call
end
test "should allow register/unregister another notifier" do
@@ -21,14 +21,14 @@
proc_notifier = lambda { |exception, options| called = true }
ExceptionNotifier.register_exception_notifier(:proc, proc_notifier)
- assert ExceptionNotifier.notifiers.sort == [:email, :proc]
+ assert_equal ExceptionNotifier.notifiers.sort, [:email, :proc]
exception = StandardError.new
ExceptionNotifier.notify_exception(exception)
- assert called == true
+ assert called
ExceptionNotifier.unregister_exception_notifier(:proc)
- assert ExceptionNotifier.notifiers == [:email]
+ assert_equal ExceptionNotifier.notifiers, [:email]
end
test "should allow select notifiers to send error to" do
@@ -40,24 +40,24 @@
notifier2 = lambda { |exception, options| notifier2_calls += 1 }
ExceptionNotifier.register_exception_notifier(:notifier2, notifier2)
- assert ExceptionNotifier.notifiers.sort == [:email, :notifier1, :notifier2]
+ assert_equal ExceptionNotifier.notifiers.sort, [:email, :notifier1, :notifier2]
exception = StandardError.new
ExceptionNotifier.notify_exception(exception)
- assert notifier1_calls == 1
- assert notifier2_calls == 1
+ assert_equal notifier1_calls, 1
+ assert_equal notifier2_calls, 1
ExceptionNotifier.notify_exception(exception, {:notifiers => :notifier1})
- assert notifier1_calls == 2
- assert notifier2_calls == 1
+ assert_equal notifier1_calls, 2
+ assert_equal notifier2_calls, 1
ExceptionNotifier.notify_exception(exception, {:notifiers => :notifier2})
- assert notifier1_calls == 2
- assert notifier2_calls == 2
+ assert_equal notifier1_calls, 2
+ assert_equal notifier2_calls, 2
ExceptionNotifier.unregister_exception_notifier(:notifier1)
ExceptionNotifier.unregister_exception_notifier(:notifier2)
- assert ExceptionNotifier.notifiers == [:email]
+ assert_equal ExceptionNotifier.notifiers, [:email]
end
test "should ignore exception if satisfies conditional ignore" do
@@ -73,11 +73,11 @@
exception = StandardError.new
ExceptionNotifier.notify_exception(exception, {:notifiers => :test})
- assert notifier_calls == 1
+ assert_equal notifier_calls, 1
env = "development"
ExceptionNotifier.notify_exception(exception, {:notifiers => :test})
- assert notifier_calls == 1
+ assert_equal notifier_calls, 1
ExceptionNotifier.clear_ignore_conditions!
ExceptionNotifier.unregister_exception_notifier(:test)
@@ -91,10 +91,10 @@
exception = StandardError.new
ExceptionNotifier.notify_exception(exception, {:notifiers => :test})
- assert notifier_calls == 1
+ assert_equal notifier_calls, 1
ExceptionNotifier.notify_exception(exception, {:notifiers => :test, :ignore_exceptions => 'StandardError' })
- assert notifier_calls == 1
+ assert_equal notifier_calls, 1
ExceptionNotifier.unregister_exception_notifier(:test)
end