loga 2.1.2 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +157 -0
  3. data/.codeclimate.yml +4 -0
  4. data/.gitignore +2 -0
  5. data/.rubocop.yml +13 -8
  6. data/Appraisals +16 -6
  7. data/CHANGELOG.md +7 -0
  8. data/Gemfile +0 -1
  9. data/Guardfile +8 -6
  10. data/README.md +1 -0
  11. data/Rakefile +1 -1
  12. data/gemfiles/rails32.gemfile +1 -2
  13. data/gemfiles/rails40.gemfile +1 -2
  14. data/gemfiles/rails42.gemfile +11 -0
  15. data/gemfiles/rails50.gemfile +1 -2
  16. data/gemfiles/rails52.gemfile +11 -0
  17. data/gemfiles/sinatra14.gemfile +1 -2
  18. data/gemfiles/unit.gemfile +1 -2
  19. data/lib/loga.rb +4 -2
  20. data/lib/loga/configuration.rb +5 -5
  21. data/lib/loga/ext/rails/rack/debug_exceptions.rb +1 -2
  22. data/lib/loga/formatters/simple_formatter.rb +1 -1
  23. data/lib/loga/log_subscribers/action_mailer.rb +59 -0
  24. data/lib/loga/rack/logger.rb +1 -1
  25. data/lib/loga/rack/request_id.rb +2 -2
  26. data/lib/loga/railtie.rb +22 -9
  27. data/lib/loga/version.rb +1 -1
  28. data/loga.gemspec +9 -8
  29. data/spec/fixtures/README.md +23 -3
  30. data/spec/fixtures/rails32.rb +79 -0
  31. data/spec/fixtures/rails40.rb +80 -0
  32. data/spec/fixtures/rails42.rb +80 -0
  33. data/spec/fixtures/rails50.rb +80 -0
  34. data/spec/fixtures/rails52.rb +80 -0
  35. data/spec/integration/rails/action_mailer_spec.rb +63 -0
  36. data/spec/integration/rails/railtie_spec.rb +15 -0
  37. data/spec/integration/sinatra_spec.rb +2 -2
  38. data/spec/spec_helper.rb +7 -8
  39. data/spec/support/gethostname_shared.rb +7 -0
  40. data/spec/support/helpers.rb +0 -4
  41. data/spec/unit/loga/configuration_spec.rb +4 -4
  42. data/spec/unit/loga/formatters/gelf_formatter_spec.rb +1 -1
  43. data/spec/unit/loga/formatters/simple_formatter_spec.rb +2 -2
  44. data/spec/unit/loga/log_subscribers/action_mailer_spec.rb +69 -0
  45. data/spec/unit/loga/rack/logger_spec.rb +1 -1
  46. data/spec/unit/loga_spec.rb +1 -1
  47. metadata +71 -225
  48. data/circle.yml +0 -23
  49. data/spec/fixtures/rails32/Rakefile +0 -7
  50. data/spec/fixtures/rails32/app/controllers/application_controller.rb +0 -28
  51. data/spec/fixtures/rails32/app/helpers/application_helper.rb +0 -2
  52. data/spec/fixtures/rails32/app/views/layouts/application.html.erb +0 -14
  53. data/spec/fixtures/rails32/app/views/user.html.erb +0 -1
  54. data/spec/fixtures/rails32/config.ru +0 -4
  55. data/spec/fixtures/rails32/config/application.rb +0 -71
  56. data/spec/fixtures/rails32/config/boot.rb +0 -6
  57. data/spec/fixtures/rails32/config/environment.rb +0 -5
  58. data/spec/fixtures/rails32/config/environments/development.rb +0 -26
  59. data/spec/fixtures/rails32/config/environments/production.rb +0 -50
  60. data/spec/fixtures/rails32/config/environments/test.rb +0 -35
  61. data/spec/fixtures/rails32/config/initializers/backtrace_silencers.rb +0 -7
  62. data/spec/fixtures/rails32/config/initializers/inflections.rb +0 -15
  63. data/spec/fixtures/rails32/config/initializers/mime_types.rb +0 -5
  64. data/spec/fixtures/rails32/config/initializers/secret_token.rb +0 -7
  65. data/spec/fixtures/rails32/config/initializers/session_store.rb +0 -8
  66. data/spec/fixtures/rails32/config/initializers/wrap_parameters.rb +0 -10
  67. data/spec/fixtures/rails32/config/locales/en.yml +0 -5
  68. data/spec/fixtures/rails32/config/routes.rb +0 -64
  69. data/spec/fixtures/rails32/public/404.html +0 -26
  70. data/spec/fixtures/rails32/public/422.html +0 -26
  71. data/spec/fixtures/rails32/public/500.html +0 -25
  72. data/spec/fixtures/rails32/public/favicon.ico +0 -0
  73. data/spec/fixtures/rails32/public/index.html +0 -241
  74. data/spec/fixtures/rails32/public/robots.txt +0 -5
  75. data/spec/fixtures/rails32/script/rails +0 -6
  76. data/spec/fixtures/rails40/Rakefile +0 -6
  77. data/spec/fixtures/rails40/app/controllers/application_controller.rb +0 -30
  78. data/spec/fixtures/rails40/app/helpers/application_helper.rb +0 -2
  79. data/spec/fixtures/rails40/app/views/layouts/application.html.erb +0 -14
  80. data/spec/fixtures/rails40/app/views/user.html.erb +0 -1
  81. data/spec/fixtures/rails40/bin/bundle +0 -3
  82. data/spec/fixtures/rails40/bin/rails +0 -4
  83. data/spec/fixtures/rails40/bin/rake +0 -4
  84. data/spec/fixtures/rails40/config.ru +0 -4
  85. data/spec/fixtures/rails40/config/application.rb +0 -37
  86. data/spec/fixtures/rails40/config/boot.rb +0 -4
  87. data/spec/fixtures/rails40/config/environment.rb +0 -5
  88. data/spec/fixtures/rails40/config/environments/development.rb +0 -24
  89. data/spec/fixtures/rails40/config/environments/production.rb +0 -65
  90. data/spec/fixtures/rails40/config/environments/test.rb +0 -39
  91. data/spec/fixtures/rails40/config/initializers/backtrace_silencers.rb +0 -7
  92. data/spec/fixtures/rails40/config/initializers/filter_parameter_logging.rb +0 -4
  93. data/spec/fixtures/rails40/config/initializers/inflections.rb +0 -16
  94. data/spec/fixtures/rails40/config/initializers/mime_types.rb +0 -5
  95. data/spec/fixtures/rails40/config/initializers/secret_token.rb +0 -12
  96. data/spec/fixtures/rails40/config/initializers/session_store.rb +0 -3
  97. data/spec/fixtures/rails40/config/initializers/wrap_parameters.rb +0 -9
  98. data/spec/fixtures/rails40/config/locales/en.yml +0 -23
  99. data/spec/fixtures/rails40/config/routes.rb +0 -62
  100. data/spec/fixtures/rails40/public/404.html +0 -58
  101. data/spec/fixtures/rails40/public/422.html +0 -58
  102. data/spec/fixtures/rails40/public/500.html +0 -57
  103. data/spec/fixtures/rails40/public/favicon.ico +0 -0
  104. data/spec/fixtures/rails40/public/robots.txt +0 -5
  105. data/spec/fixtures/rails50/Rakefile +0 -6
  106. data/spec/fixtures/rails50/app/controllers/application_controller.rb +0 -28
  107. data/spec/fixtures/rails50/app/helpers/application_helper.rb +0 -2
  108. data/spec/fixtures/rails50/app/views/layouts/application.html.erb +0 -13
  109. data/spec/fixtures/rails50/app/views/user.html.erb +0 -1
  110. data/spec/fixtures/rails50/bin/bundle +0 -3
  111. data/spec/fixtures/rails50/bin/rails +0 -4
  112. data/spec/fixtures/rails50/bin/rake +0 -4
  113. data/spec/fixtures/rails50/bin/setup +0 -34
  114. data/spec/fixtures/rails50/bin/update +0 -29
  115. data/spec/fixtures/rails50/config.ru +0 -5
  116. data/spec/fixtures/rails50/config/application.rb +0 -34
  117. data/spec/fixtures/rails50/config/boot.rb +0 -3
  118. data/spec/fixtures/rails50/config/cable.yml +0 -9
  119. data/spec/fixtures/rails50/config/environment.rb +0 -5
  120. data/spec/fixtures/rails50/config/environments/development.rb +0 -44
  121. data/spec/fixtures/rails50/config/environments/production.rb +0 -75
  122. data/spec/fixtures/rails50/config/environments/test.rb +0 -42
  123. data/spec/fixtures/rails50/config/initializers/application_controller_renderer.rb +0 -6
  124. data/spec/fixtures/rails50/config/initializers/backtrace_silencers.rb +0 -7
  125. data/spec/fixtures/rails50/config/initializers/cookies_serializer.rb +0 -5
  126. data/spec/fixtures/rails50/config/initializers/filter_parameter_logging.rb +0 -4
  127. data/spec/fixtures/rails50/config/initializers/inflections.rb +0 -16
  128. data/spec/fixtures/rails50/config/initializers/mime_types.rb +0 -4
  129. data/spec/fixtures/rails50/config/initializers/new_framework_defaults.rb +0 -21
  130. data/spec/fixtures/rails50/config/initializers/session_store.rb +0 -3
  131. data/spec/fixtures/rails50/config/initializers/wrap_parameters.rb +0 -9
  132. data/spec/fixtures/rails50/config/locales/en.yml +0 -23
  133. data/spec/fixtures/rails50/config/puma.rb +0 -47
  134. data/spec/fixtures/rails50/config/routes.rb +0 -9
  135. data/spec/fixtures/rails50/config/secrets.yml +0 -23
  136. data/spec/fixtures/rails50/public/404.html +0 -67
  137. data/spec/fixtures/rails50/public/422.html +0 -67
  138. data/spec/fixtures/rails50/public/500.html +0 -66
  139. data/spec/fixtures/rails50/public/apple-touch-icon-precomposed.png +0 -0
  140. data/spec/fixtures/rails50/public/apple-touch-icon.png +0 -0
  141. data/spec/fixtures/rails50/public/favicon.ico +0 -0
  142. data/spec/fixtures/rails50/public/robots.txt +0 -5
@@ -0,0 +1,80 @@
1
+ require 'action_controller/railtie'
2
+ require 'action_mailer/railtie'
3
+
4
+ Bundler.require(*Rails.groups)
5
+
6
+ STREAM = StringIO.new unless defined?(STREAM)
7
+
8
+ class Dummy < Rails::Application
9
+ config.eager_load = true
10
+ config.filter_parameters += [:password]
11
+ config.secret_key_base = '2624599ca9ab3cf3823626240138a128118a87683bf03ab8f155844c33b3cd8cbbfa3ef5e29db6f5bd182f8bd4776209d9577cfb46ac51bfd232b00ab0136b24'
12
+ config.session_store :cookie_store, key: '_rails50_session'
13
+
14
+ config.log_tags = [:uuid, 'TEST_TAG']
15
+ config.loga = {
16
+ device: STREAM,
17
+ host: 'bird.example.com',
18
+ service_name: 'hello_world_app',
19
+ service_version: '1.0',
20
+ }
21
+ config.action_mailer.delivery_method = :test
22
+ end
23
+
24
+ class ApplicationController < ActionController::Base
25
+ include Rails.application.routes.url_helpers
26
+ protect_from_forgery with: :null_session
27
+
28
+ def ok
29
+ render plain: 'Hello Rails'
30
+ end
31
+
32
+ def error
33
+ nil.name
34
+ end
35
+
36
+ def show
37
+ render json: params
38
+ end
39
+
40
+ def create
41
+ render json: params
42
+ end
43
+
44
+ def new
45
+ redirect_to :ok
46
+ end
47
+
48
+ def update
49
+ @id = params[:id]
50
+ render '/user'
51
+ end
52
+ end
53
+
54
+ class FakeMailer < ActionMailer::Base
55
+ default from: 'notifications@example.com'
56
+
57
+ def self.send_email
58
+ basic_mail.deliver_now
59
+ end
60
+
61
+ def basic_mail
62
+ mail(
63
+ to: 'user@example.com',
64
+ subject: 'Welcome to My Awesome Site',
65
+ body: 'Banana muffin',
66
+ content_type: 'text/html',
67
+ )
68
+ end
69
+ end
70
+
71
+ Dummy.routes.append do
72
+ get 'ok' => 'application#ok'
73
+ get 'error' => 'application#error'
74
+ get 'show' => 'application#show'
75
+ post 'users' => 'application#create'
76
+ get 'new' => 'application#new'
77
+ put 'users/:id' => 'application#update'
78
+ end
79
+
80
+ Dummy.initialize!
@@ -0,0 +1,80 @@
1
+ require 'action_controller/railtie'
2
+ require 'action_mailer/railtie'
3
+
4
+ Bundler.require(*Rails.groups)
5
+
6
+ STREAM = StringIO.new unless defined?(STREAM)
7
+
8
+ class Dummy < Rails::Application
9
+ config.eager_load = true
10
+ config.filter_parameters += [:password]
11
+ config.secret_key_base = '2624599ca9ab3cf3823626240138a128118a87683bf03ab8f155844c33b3cd8cbbfa3ef5e29db6f5bd182f8bd4776209d9577cfb46ac51bfd232b00ab0136b24'
12
+ config.session_store :cookie_store, key: '_rails52_session'
13
+
14
+ config.log_tags = [:uuid, 'TEST_TAG']
15
+ config.loga = {
16
+ device: STREAM,
17
+ host: 'bird.example.com',
18
+ service_name: 'hello_world_app',
19
+ service_version: '1.0',
20
+ }
21
+ config.action_mailer.delivery_method = :test
22
+ end
23
+
24
+ class ApplicationController < ActionController::Base
25
+ include Rails.application.routes.url_helpers
26
+ protect_from_forgery with: :null_session
27
+
28
+ def ok
29
+ render plain: 'Hello Rails'
30
+ end
31
+
32
+ def error
33
+ nil.name
34
+ end
35
+
36
+ def show
37
+ render json: params
38
+ end
39
+
40
+ def create
41
+ render json: params
42
+ end
43
+
44
+ def new
45
+ redirect_to :ok
46
+ end
47
+
48
+ def update
49
+ @id = params[:id]
50
+ render '/user'
51
+ end
52
+ end
53
+
54
+ class FakeMailer < ActionMailer::Base
55
+ default from: 'notifications@example.com'
56
+
57
+ def self.send_email
58
+ basic_mail.deliver_now
59
+ end
60
+
61
+ def basic_mail
62
+ mail(
63
+ to: 'user@example.com',
64
+ subject: 'Welcome to My Awesome Site',
65
+ body: 'Banana muffin',
66
+ content_type: 'text/html',
67
+ )
68
+ end
69
+ end
70
+
71
+ Dummy.routes.append do
72
+ get 'ok' => 'application#ok'
73
+ get 'error' => 'application#error'
74
+ get 'show' => 'application#show'
75
+ post 'users' => 'application#create'
76
+ get 'new' => 'application#new'
77
+ put 'users/:id' => 'application#update'
78
+ end
79
+
80
+ Dummy.initialize!
@@ -0,0 +1,63 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Loga::LogSubscribers::ActionMailer, if: Rails.env.production? do
4
+ let(:log_entries) do
5
+ entries = []
6
+ STREAM.tap do |s|
7
+ s.rewind
8
+ entries = s.read.split("\n").map { |line| JSON.parse(line) }
9
+ s.close
10
+ s.reopen
11
+ end
12
+ entries
13
+ end
14
+
15
+ let(:last_log_entry) { log_entries.last }
16
+
17
+ context 'when an email is being sent' do
18
+ it 'delivers an email' do
19
+ send_mail = -> { FakeMailer.send_email }
20
+
21
+ expect(&send_mail).to change { FakeMailer.deliveries.size }.by(1)
22
+ end
23
+
24
+ if Gem::Version.new(Rails.version) >= Gem::Version.new('5.0.0')
25
+ it 'has the proper payload for message processing' do
26
+ configuration = Loga::Configuration.new(
27
+ format: :gelf,
28
+ service_name: 'loga_test',
29
+ device: STREAM,
30
+ level: :debug,
31
+ )
32
+
33
+ allow(Loga).to receive(:logger).and_return(configuration.logger)
34
+
35
+ FakeMailer.send_email
36
+
37
+ message_pattern = /^FakeMailer#basic_mail: Processed outbound mail in\(*/
38
+ short_message = log_entries.last(2).first['short_message']
39
+
40
+ expect(short_message).to match message_pattern
41
+ end
42
+ end
43
+
44
+ it 'has the proper payload for message delivery' do
45
+ FakeMailer.send_email
46
+
47
+ message_pattern = /^FakeMailer: Sent mail to user@example.com in \(*/
48
+ expect(last_log_entry['short_message']).to match(message_pattern)
49
+ end
50
+
51
+ it 'has the additional key "_mailer"' do
52
+ FakeMailer.send_email
53
+
54
+ expect(last_log_entry).to have_key('_mailer')
55
+ end
56
+
57
+ it 'has the additional key "_unique_id"' do
58
+ FakeMailer.send_email
59
+
60
+ expect(last_log_entry).to have_key('_unique_id')
61
+ end
62
+ end
63
+ end
@@ -52,6 +52,7 @@ RSpec.describe Loga::Railtie do
52
52
  let(:listeners) do
53
53
  ActiveSupport::Notifications.notifier.listeners_for(notification)
54
54
  end
55
+
55
56
  let(:subscribers) do
56
57
  listeners.map { |l| l.instance_variable_get(:@delegate).class }
57
58
  end
@@ -94,6 +95,20 @@ RSpec.describe Loga::Railtie do
94
95
  end
95
96
  end
96
97
  end
98
+
99
+ context 'ActionMailer' do
100
+ [
101
+ 'receive.action_mailer',
102
+ 'deliver.action_mailer',
103
+ 'process.action_mailer',
104
+ ].each do |notification|
105
+ let(:notification) { notification }
106
+
107
+ it 'removes ActionMailer::LogSubscriber' do
108
+ expect(subscribers).to_not include(ActionMailer::LogSubscriber)
109
+ end
110
+ end
111
+ end
97
112
  end
98
113
  end
99
114
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  class MySinatraApp < Sinatra::Base
4
- set :logging, :false
4
+ set :logging, false
5
5
 
6
6
  get '/ok' do
7
7
  'Hello Sinatra'
@@ -21,7 +21,7 @@ class MySinatraApp < Sinatra::Base
21
21
  end
22
22
  end
23
23
 
24
- RSpec.describe 'Structured logging with Sinatra', timecop: true do
24
+ RSpec.describe 'Structured logging with Sinatra', :with_hostname, :timecop do
25
25
  let(:io) { StringIO.new }
26
26
  let(:format) {}
27
27
  before do
@@ -1,16 +1,14 @@
1
+ require 'byebug'
1
2
  require 'pry'
3
+ require 'support/gethostname_shared'
2
4
  require 'support/helpers'
3
- require 'support/timecop_shared'
4
5
  require 'support/request_spec'
6
+ require 'support/timecop_shared'
5
7
  require 'rack/test'
6
8
  require 'simplecov'
7
9
 
8
- SimpleCov.start
9
-
10
- class Socket
11
- def self.gethostname
12
- 'bird.example.com'
13
- end
10
+ SimpleCov.start do
11
+ command_name "ruby-#{RUBY_VERSION}-#{File.basename(ENV['BUNDLE_GEMFILE'], '.gemfile')}"
14
12
  end
15
13
 
16
14
  case ENV['BUNDLE_GEMFILE']
@@ -18,7 +16,8 @@ when /rails/
18
16
  rspec_pattern = 'integration/rails/**/*_spec.rb'
19
17
  /(?<appraisal>rails\d{2})\.gemfile/ =~ ENV['BUNDLE_GEMFILE']
20
18
  require 'rails'
21
- require File.expand_path("../fixtures/#{appraisal}/config/environment.rb", __FILE__)
19
+ require 'action_mailer'
20
+ require File.expand_path("../fixtures/#{appraisal}.rb", __FILE__)
22
21
  when /sinatra/
23
22
  rspec_pattern = 'integration/sinatra_spec.rb'
24
23
  require 'json'
@@ -0,0 +1,7 @@
1
+ shared_context 'gethostname', with_hostname: true do
2
+ let(:hostname) { 'bird.example.com' }
3
+
4
+ before do
5
+ allow(Socket).to receive(:gethostname).and_return(hostname)
6
+ end
7
+ end
@@ -9,8 +9,4 @@ module Helpers
9
9
  def time_anchor_unix
10
10
  BigDecimal.new('1450150205.123')
11
11
  end
12
-
13
- def hostname_anchor
14
- 'bird.example.com'
15
- end
16
12
  end
@@ -9,23 +9,23 @@ describe Loga::Configuration do
9
9
 
10
10
  describe 'initialize' do
11
11
  let(:framework_exceptions) do
12
- %w(
12
+ %w[
13
13
  ActionController::RoutingError
14
14
  ActiveRecord::RecordNotFound
15
15
  Sinatra::NotFound
16
- )
16
+ ]
17
17
  end
18
18
 
19
19
  before do
20
20
  allow(Loga::ServiceVersionStrategies).to receive(:call).and_return('unknown.sha')
21
21
  end
22
22
 
23
- context 'defaults' do
23
+ context 'defaults', with_hostname: true do
24
24
  specify { expect(subject.device).to eq(STDOUT) }
25
25
  specify { expect(subject.filter_exceptions).to eq(framework_exceptions) }
26
26
  specify { expect(subject.filter_parameters).to eq([]) }
27
27
  specify { expect(subject.format).to eq(:simple) }
28
- specify { expect(subject.host).to eq(hostname_anchor) }
28
+ specify { expect(subject.host).to eq(hostname) }
29
29
  specify { expect(subject.level).to eq(:info) }
30
30
  specify { expect(subject.service_name).to eq('hello_world_app') }
31
31
  specify { expect(subject.service_version).to eq('unknown.sha') }
@@ -109,7 +109,7 @@ describe Loga::Formatters::GELFFormatter do
109
109
  end
110
110
 
111
111
  context 'when the Event has an exception' do
112
- let(:backtrace) { %w(a b) }
112
+ let(:backtrace) { %w[a b] }
113
113
  let(:exception) do
114
114
  StandardError.new('Foo Error').tap { |e| e.set_backtrace backtrace }
115
115
  end
@@ -54,7 +54,7 @@ describe Loga::Formatters::SimpleFormatter do
54
54
  end
55
55
 
56
56
  context 'when the Event has an exception' do
57
- let(:backtrace) { %w(a b) }
57
+ let(:backtrace) { %w[a b] }
58
58
  let(:exception) do
59
59
  StandardError.new('Foo Error').tap { |e| e.set_backtrace backtrace }
60
60
  end
@@ -97,7 +97,7 @@ describe Loga::Formatters::SimpleFormatter do
97
97
  end
98
98
 
99
99
  context 'when tags are available' do
100
- let(:tags) { %w(USER_54321 EmailWorker) }
100
+ let(:tags) { %w[USER_54321 EmailWorker] }
101
101
 
102
102
  before do
103
103
  allow_any_instance_of(described_class).to receive(:current_tags).and_return(tags)
@@ -0,0 +1,69 @@
1
+ require 'spec_helper'
2
+ require 'active_support'
3
+ require 'loga/log_subscribers/action_mailer'
4
+
5
+ RSpec.describe Loga::LogSubscribers::ActionMailer do
6
+ subject(:mailer) { described_class.new }
7
+
8
+ let(:event) do
9
+ double('event', payload: payload, duration: 0.0001, time: Time.now)
10
+ end
11
+
12
+ before do
13
+ Loga.reset
14
+
15
+ Loga.configure(service_name: 'hello_world_app')
16
+ end
17
+
18
+ describe '#deliver' do
19
+ context 'when an email is sent' do
20
+ let(:payload) do
21
+ {
22
+ mailer: 'FakeMailer',
23
+ to: ['user@example.com'],
24
+ }
25
+ end
26
+
27
+ it 'logs an info message' do
28
+ expect(Loga.logger).to receive(:info).with(kind_of(Loga::Event))
29
+
30
+ mailer.deliver(event)
31
+ end
32
+ end
33
+ end
34
+
35
+ describe '#process' do
36
+ context 'when an email is sent' do
37
+ let(:payload) do
38
+ {
39
+ mailer: 'FakeMailer',
40
+ action: 'hello_world',
41
+ }
42
+ end
43
+
44
+ it 'logs an info message' do
45
+ expect(Loga.logger).to receive(:debug).with(kind_of(Loga::Event))
46
+
47
+ mailer.process(event)
48
+ end
49
+ end
50
+ end
51
+
52
+ describe '#receive' do
53
+ context 'when an email is sent' do
54
+ let(:payload) do
55
+ {
56
+ mailer: 'FakeMailer',
57
+ from: 'loremipsum@example.com',
58
+ subject: 'Lorem ipsum',
59
+ }
60
+ end
61
+
62
+ it 'logs an info message' do
63
+ expect(Loga.logger).to receive(:info).with(kind_of(Loga::Event))
64
+
65
+ mailer.receive(event)
66
+ end
67
+ end
68
+ end
69
+ end