inst_statsd 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/inst_statsd.rb CHANGED
@@ -1,24 +1,31 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'statsd'
3
+ require "statsd"
4
4
 
5
5
  module InstStatsd
6
- VALID_SETTINGS = %i[host port namespace append_hostname mask negative_mask batch_size batch_byte_size
6
+ VALID_SETTINGS = %i[host
7
+ port
8
+ namespace
9
+ append_hostname
10
+ mask
11
+ negative_mask
12
+ batch_size
13
+ batch_byte_size
7
14
  dog_tags].freeze
8
15
 
9
16
  class ConfigurationError < StandardError; end
10
17
 
11
- require 'inst_statsd/event'
12
- require 'inst_statsd/statsd'
13
- require 'inst_statsd/block_stat'
14
- require 'inst_statsd/block_tracking'
15
- require 'inst_statsd/request_stat'
16
- require 'inst_statsd/counter'
17
- require 'inst_statsd/sql_tracker'
18
- require 'inst_statsd/default_tracking'
19
- require 'inst_statsd/request_logger'
20
- require 'inst_statsd/request_tracking'
21
- require 'inst_statsd/null_logger'
18
+ require "inst_statsd/event"
19
+ require "inst_statsd/statsd"
20
+ require "inst_statsd/block_stat"
21
+ require "inst_statsd/block_tracking"
22
+ require "inst_statsd/request_stat"
23
+ require "inst_statsd/counter"
24
+ require "inst_statsd/sql_tracker"
25
+ require "inst_statsd/default_tracking"
26
+ require "inst_statsd/request_logger"
27
+ require "inst_statsd/request_tracking"
28
+ require "inst_statsd/null_logger"
22
29
 
23
30
  class << self
24
31
  def settings
@@ -33,11 +40,11 @@ module InstStatsd
33
40
  return nil if value.nil?
34
41
 
35
42
  validated = {}
43
+ regexp_methods = %i[mask negative_mask]
36
44
  value.each do |k, v|
37
- unless VALID_SETTINGS.include?(k.to_sym)
38
- raise InstStatsd::ConfigurationError, "Invalid key: #{k}"
39
- end
40
- v = Regexp.new(v) if %i[mask negative_mask].include?(k.to_sym) && v.is_a?(String)
45
+ raise InstStatsd::ConfigurationError, "Invalid key: #{k}" unless VALID_SETTINGS.include?(k.to_sym)
46
+
47
+ v = Regexp.new(v) if regexp_methods.include?(k.to_sym) && v.is_a?(String)
41
48
  validated[k.to_sym] = v
42
49
  end
43
50
 
@@ -45,19 +52,17 @@ module InstStatsd
45
52
  end
46
53
 
47
54
  def env_settings(env = ENV)
48
- dog_tags = JSON.parse(env['INST_DOG_TAGS']).to_h if env['INST_DOG_TAGS']
55
+ dog_tags = JSON.parse(env["INST_DOG_TAGS"]).to_h if env["INST_DOG_TAGS"]
49
56
  config = {
50
- host: env.fetch('INST_STATSD_HOST', nil),
51
- port: env.fetch('INST_STATSD_PORT', nil),
52
- namespace: env.fetch('INST_STATSD_NAMESPACE', nil),
53
- append_hostname: env.fetch('INST_STATSD_APPEND_HOSTNAME', nil),
57
+ host: env.fetch("INST_STATSD_HOST", nil),
58
+ port: env.fetch("INST_STATSD_PORT", nil),
59
+ namespace: env.fetch("INST_STATSD_NAMESPACE", nil),
60
+ append_hostname: env.fetch("INST_STATSD_APPEND_HOSTNAME", nil),
54
61
  dog_tags: dog_tags
55
62
  }
56
- config.delete_if { |_k, v| v.nil? }
63
+ config.compact!
57
64
  convert_bool(config, :append_hostname)
58
- if config[:host]
59
- config
60
- elsif config[:dog_tags]
65
+ if config[:host] || config[:dog_tags]
61
66
  config
62
67
  else
63
68
  {}
@@ -67,11 +72,12 @@ module InstStatsd
67
72
  def convert_bool(hash, key)
68
73
  value = hash[key]
69
74
  return if value.nil?
70
- unless ['true', 'True', 'false', 'False', true, false].include?(value)
75
+
76
+ unless ["true", "True", "false", "False", true, false].include?(value)
71
77
  message = "#{key} must be a boolean, or the string representation of a boolean, got: #{value}"
72
78
  raise InstStatsd::ConfigurationError, message
73
79
  end
74
- hash[key] = ['true', 'True', true].include?(value)
80
+ hash[key] = ["true", "True", true].include?(value)
75
81
  end
76
82
  end
77
83
  end
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require "spec_helper"
4
4
 
5
5
  describe InstStatsd::BlockStat do
6
6
  it "track exclusives correctly" do
7
7
  stat = InstStatsd::BlockStat.new("key")
8
- stat.stats['total'] = 5.0
8
+ stat.stats["total"] = 5.0
9
9
  stat.subtract_exclusives("total" => 1.5)
10
10
  stat.subtract_exclusives("total" => 2.1)
11
11
  expect(stat.exclusive_stats).to eql("total" => 1.4)
@@ -1,62 +1,82 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require "spec_helper"
4
4
 
5
5
  describe InstStatsd::BlockTracking do
6
- before(:all) do
6
+ before(:all) do # rubocop:disable RSpec/BeforeAfterAll
7
7
  InstStatsd::DefaultTracking.track_sql
8
8
  end
9
9
 
10
10
  it "works" do
11
- statsd = double()
12
- allow(statsd).to receive(:timing).with('mykey.total', anything, {short_stat: "mykey.total", tags: {}})
13
- expect(statsd).to receive(:timing).with("mykey.sql.read", 1, {short_stat: "mykey.sql.read", tags: {}})
11
+ statsd = double
12
+ allow(statsd).to receive(:timing).with("mykey.total", anything, { short_stat: "mykey.total", tags: {} })
13
+ expect(statsd).to receive(:timing).with("mykey.sql.read", 1, { short_stat: "mykey.sql.read", tags: {} })
14
14
 
15
- InstStatsd::BlockTracking.track("mykey", statsd: statsd, only: 'sql.read') do
16
- ActiveSupport::Notifications.instrument('sql.active_record', name: "LOAD", sql: "SELECT * FROM users") {}
15
+ InstStatsd::BlockTracking.track("mykey", statsd: statsd, only: "sql.read") do
16
+ ActiveSupport::Notifications.instrument("sql.active_record", name: "LOAD", sql: "SELECT * FROM users") { nil }
17
17
  end
18
18
  end
19
19
 
20
20
  it "works for data_dog" do
21
- statsd = double()
21
+ statsd = double
22
22
  allow(statsd).to receive(:data_dog?).and_return true
23
- allow(statsd).to receive(:timing).with('mykey.total', anything, {short_stat: "mykey.total", tags: {app: "canvas", env: "prod"}})
24
- expect(statsd).to receive(:timing).with("mykey.sql.read", 1, {short_stat: "mykey.sql.read", tags: {app: "canvas", env: "prod"}})
23
+ allow(statsd).to receive(:timing).with("mykey.total",
24
+ anything,
25
+ { short_stat: "mykey.total", tags: { app: "canvas", env: "prod" } })
26
+ expect(statsd).to receive(:timing).with("mykey.sql.read",
27
+ 1,
28
+ { short_stat: "mykey.sql.read", tags: { app: "canvas", env: "prod" } })
25
29
 
26
- InstStatsd::BlockTracking.track("mykey", statsd: statsd, only: 'sql.read', tags: {app: 'canvas', env: 'prod'}, short_stat: 'mykey') do
27
- ActiveSupport::Notifications.instrument('sql.active_record', name: "LOAD", sql: "SELECT * FROM users") {}
30
+ InstStatsd::BlockTracking.track("mykey",
31
+ statsd: statsd,
32
+ only: "sql.read",
33
+ tags: { app: "canvas", env: "prod" },
34
+ short_stat: "mykey") do
35
+ ActiveSupport::Notifications.instrument("sql.active_record", name: "LOAD", sql: "SELECT * FROM users") { nil }
28
36
  end
29
37
  end
30
38
 
31
39
  it "keeps track of exclusive stats too" do
32
- statsd = double()
33
- expect(statsd).to receive(:timing).with("mykey.sql.read", 2, {short_stat: "mykey.sql.read", tags: {}}).ordered
34
- expect(statsd).to receive(:timing).with('mykey.total', anything, {short_stat: "mykey.total", tags: {}}).ordered
35
- expect(statsd).to receive(:timing).with("mykey.exclusive.sql.read", 2, {short_stat: "mykey.exclusive.sql.read", tags: {}}).ordered
36
- expect(statsd).to receive(:timing).with('mykey.exclusive.total', anything, {short_stat: "mykey.exclusive.total", tags: {}}).ordered
37
- expect(statsd).to receive(:timing).with("mykey.sql.read", 2, {short_stat: "mykey.sql.read", tags: {}}).ordered
38
- expect(statsd).to receive(:timing).with('mykey.total', anything, {short_stat: "mykey.total", tags: {}}).ordered
39
- expect(statsd).to receive(:timing).with("mykey.exclusive.sql.read", 2, {short_stat: "mykey.exclusive.sql.read", tags: {}}).ordered
40
- expect(statsd).to receive(:timing).with('mykey.exclusive.total', anything, {short_stat: "mykey.exclusive.total", tags: {}}).ordered
41
- expect(statsd).to receive(:timing).with("mykey.sql.read", 5, {short_stat: "mykey.sql.read", tags: {}}).ordered
42
- expect(statsd).to receive(:timing).with('mykey.total', anything, {short_stat: "mykey.total", tags: {}}).ordered
43
- expect(statsd).to receive(:timing).with("mykey.exclusive.sql.read", 1, {short_stat: "mykey.exclusive.sql.read", tags: {}}).ordered
44
- expect(statsd).to receive(:timing).with('mykey.exclusive.total', anything, {short_stat: "mykey.exclusive.total", tags: {}}).ordered
40
+ statsd = double
41
+ expect(statsd).to receive(:timing).with("mykey.sql.read", 2, { short_stat: "mykey.sql.read", tags: {} }).ordered
42
+ expect(statsd).to receive(:timing).with("mykey.total", anything, { short_stat: "mykey.total", tags: {} }).ordered
43
+ expect(statsd).to receive(:timing).with("mykey.exclusive.sql.read",
44
+ 2,
45
+ { short_stat: "mykey.exclusive.sql.read", tags: {} }).ordered
46
+ expect(statsd).to receive(:timing).with("mykey.exclusive.total",
47
+ anything,
48
+ { short_stat: "mykey.exclusive.total", tags: {} }).ordered
49
+ expect(statsd).to receive(:timing).with("mykey.sql.read", 2, { short_stat: "mykey.sql.read", tags: {} }).ordered
50
+ expect(statsd).to receive(:timing).with("mykey.total", anything, { short_stat: "mykey.total", tags: {} }).ordered
51
+ expect(statsd).to receive(:timing).with("mykey.exclusive.sql.read",
52
+ 2,
53
+ { short_stat: "mykey.exclusive.sql.read", tags: {} }).ordered
54
+ expect(statsd).to receive(:timing).with("mykey.exclusive.total",
55
+ anything,
56
+ { short_stat: "mykey.exclusive.total", tags: {} }).ordered
57
+ expect(statsd).to receive(:timing).with("mykey.sql.read", 5, { short_stat: "mykey.sql.read", tags: {} }).ordered
58
+ expect(statsd).to receive(:timing).with("mykey.total", anything, { short_stat: "mykey.total", tags: {} }).ordered
59
+ expect(statsd).to receive(:timing).with("mykey.exclusive.sql.read",
60
+ 1,
61
+ { short_stat: "mykey.exclusive.sql.read", tags: {} }).ordered
62
+ expect(statsd).to receive(:timing).with("mykey.exclusive.total",
63
+ anything,
64
+ { short_stat: "mykey.exclusive.total", tags: {} }).ordered
45
65
 
46
- InstStatsd::BlockTracking.track("mykey", category: :nested, statsd: statsd, only: 'sql.read') do
47
- ActiveSupport::Notifications.instrument('sql.active_record', name: "LOAD", sql: "SELECT * FROM users") {}
48
- InstStatsd::BlockTracking.track("mykey", category: :nested, statsd: statsd, only: 'sql.read') do
49
- ActiveSupport::Notifications.instrument('sql.active_record', name: "LOAD", sql: "SELECT * FROM users") {}
50
- ActiveSupport::Notifications.instrument('sql.active_record', name: "LOAD", sql: "SELECT * FROM users") {}
66
+ InstStatsd::BlockTracking.track("mykey", category: :nested, statsd: statsd, only: "sql.read") do
67
+ ActiveSupport::Notifications.instrument("sql.active_record", name: "LOAD", sql: "SELECT * FROM users") { nil }
68
+ InstStatsd::BlockTracking.track("mykey", category: :nested, statsd: statsd, only: "sql.read") do
69
+ ActiveSupport::Notifications.instrument("sql.active_record", name: "LOAD", sql: "SELECT * FROM users") { nil }
70
+ ActiveSupport::Notifications.instrument("sql.active_record", name: "LOAD", sql: "SELECT * FROM users") { nil }
51
71
  end
52
- InstStatsd::BlockTracking.track("mykey", category: :nested, statsd: statsd, only: 'sql.read') do
53
- ActiveSupport::Notifications.instrument('sql.active_record', name: "LOAD", sql: "SELECT * FROM users") {}
54
- ActiveSupport::Notifications.instrument('sql.active_record', name: "LOAD", sql: "SELECT * FROM users") {}
72
+ InstStatsd::BlockTracking.track("mykey", category: :nested, statsd: statsd, only: "sql.read") do
73
+ ActiveSupport::Notifications.instrument("sql.active_record", name: "LOAD", sql: "SELECT * FROM users") { nil }
74
+ ActiveSupport::Notifications.instrument("sql.active_record", name: "LOAD", sql: "SELECT * FROM users") { nil }
55
75
  end
56
76
  end
57
77
  end
58
78
 
59
- context "mask" do
79
+ context "with a mask" do
60
80
  after do
61
81
  InstStatsd::BlockTracking.mask = nil
62
82
  InstStatsd::BlockTracking.negative_mask = nil
@@ -64,26 +84,26 @@ describe InstStatsd::BlockTracking do
64
84
 
65
85
  it "only tracks keys that match the mask" do
66
86
  InstStatsd::BlockTracking.mask = /mykey/
67
- statsd = double()
68
- allow(statsd).to receive(:timing).with('mykey.total', anything, {short_stat: "mykey.total", tags: {}})
69
- expect(statsd).to receive(:timing).with("mykey.sql.read", 1, {short_stat: "mykey.sql.read", tags: {}})
87
+ statsd = double
88
+ allow(statsd).to receive(:timing).with("mykey.total", anything, { short_stat: "mykey.total", tags: {} })
89
+ expect(statsd).to receive(:timing).with("mykey.sql.read", 1, { short_stat: "mykey.sql.read", tags: {} })
70
90
 
71
- InstStatsd::BlockTracking.track("mykey", statsd: statsd, only: 'sql.read') do
72
- InstStatsd::BlockTracking.track("ignoreme", statsd: statsd, only: 'sql.read') do
73
- ActiveSupport::Notifications.instrument('sql.active_record', name: "LOAD", sql: "SELECT * FROM users") {}
91
+ InstStatsd::BlockTracking.track("mykey", statsd: statsd, only: "sql.read") do
92
+ InstStatsd::BlockTracking.track("ignoreme", statsd: statsd, only: "sql.read") do
93
+ ActiveSupport::Notifications.instrument("sql.active_record", name: "LOAD", sql: "SELECT * FROM users") { nil }
74
94
  end
75
95
  end
76
96
  end
77
97
 
78
98
  it "doesn't track keys that match the negative mask" do
79
99
  InstStatsd::BlockTracking.negative_mask = /ignoreme/
80
- statsd = double()
81
- allow(statsd).to receive(:timing).with('mykey.total', anything, {short_stat: "mykey.total", tags: {}})
82
- expect(statsd).to receive(:timing).with("mykey.sql.read", 1, {short_stat: "mykey.sql.read", tags: {}})
100
+ statsd = double
101
+ allow(statsd).to receive(:timing).with("mykey.total", anything, { short_stat: "mykey.total", tags: {} })
102
+ expect(statsd).to receive(:timing).with("mykey.sql.read", 1, { short_stat: "mykey.sql.read", tags: {} })
83
103
 
84
- InstStatsd::BlockTracking.track("mykey", statsd: statsd, only: 'sql.read') do
85
- InstStatsd::BlockTracking.track("ignoreme", statsd: statsd, only: 'sql.read') do
86
- ActiveSupport::Notifications.instrument('sql.active_record', name: "LOAD", sql: "SELECT * FROM users") {}
104
+ InstStatsd::BlockTracking.track("mykey", statsd: statsd, only: "sql.read") do
105
+ InstStatsd::BlockTracking.track("ignoreme", statsd: statsd, only: "sql.read") do
106
+ ActiveSupport::Notifications.instrument("sql.active_record", name: "LOAD", sql: "SELECT * FROM users") { nil }
87
107
  end
88
108
  end
89
109
  end
@@ -1,60 +1,58 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require "spec_helper"
4
4
 
5
5
  describe InstStatsd::Counter do
6
-
7
- let(:subject) { InstStatsd::Counter.new('test', ['foo']) }
6
+ subject { InstStatsd::Counter.new("test", ["foo"]) }
8
7
 
9
8
  describe "#accepted_name?" do
10
- it 'should return true for names not in blocked_names' do
11
- expect(subject.accepted_name?('bar')).to eq true
9
+ it "should return true for names not in blocked_names" do
10
+ expect(subject.accepted_name?("bar")).to be true
12
11
  end
13
12
 
14
- it 'should return false for names in blocked_names' do
15
- expect(subject.accepted_name?('foo')).to eq false
13
+ it "should return false for names in blocked_names" do
14
+ expect(subject.accepted_name?("foo")).to be false
16
15
  end
17
16
 
18
- it 'should return true for empty string names' do
19
- expect(subject.accepted_name?('')).to eq true
17
+ it "should return true for empty string names" do
18
+ expect(subject.accepted_name?("")).to be true
20
19
  end
21
20
 
22
- it 'should return true for empty nil names' do
23
- expect(subject.accepted_name?(nil)).to eq true
21
+ it "should return true for empty nil names" do
22
+ expect(subject.accepted_name?(nil)).to be true
24
23
  end
25
24
  end
26
25
 
27
26
  describe "#track" do
28
- it 'should increment when given allowed names' do
27
+ it "should increment when given allowed names" do
29
28
  cookie = subject.start
30
- subject.track('bar')
31
- subject.track('baz')
29
+ subject.track("bar")
30
+ subject.track("baz")
32
31
  expect(subject.finalize_count(cookie)).to eq 2
33
32
  end
34
33
 
35
- it 'should not increment when given a blocked name' do
34
+ it "should not increment when given a blocked name" do
36
35
  cookie = subject.start
37
- subject.track('foo') #shouldn't count as foo is a blocked name
38
- subject.track('name')
36
+ subject.track("foo") # shouldn't count as foo is a blocked name
37
+ subject.track("name")
39
38
  expect(subject.finalize_count(cookie)).to eq 1
40
39
  end
41
40
  end
42
41
 
43
42
  describe "#finalize_count" do
44
- it 'should return the current count' do
43
+ it "should return the current count" do
45
44
  cookie = subject.start
46
- subject.track('bar')
45
+ subject.track("bar")
47
46
  expect(subject.finalize_count(cookie)).to eq 1
48
47
  end
49
48
 
50
- it 'should not interfere with multiple people using the object' do
49
+ it "should not interfere with multiple people using the object" do
51
50
  cookie1 = subject.start
52
- subject.track('bar')
51
+ subject.track("bar")
53
52
  cookie2 = subject.start
54
- subject.track('bar')
53
+ subject.track("bar")
55
54
  expect(subject.finalize_count(cookie1)).to eq 2
56
55
  expect(subject.finalize_count(cookie2)).to eq 1
57
56
  end
58
57
  end
59
-
60
58
  end
@@ -1,22 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require "spec_helper"
4
+ require "datadog/statsd"
4
5
 
5
6
  RSpec.describe InstStatsd::Event do
6
7
  include described_class
7
8
 
8
9
  let(:title) { "Title" }
9
- let(:text) {"Some text."}
10
+ let(:text) { "Some text." }
10
11
 
11
- let(:instance) { double }
12
+ let(:instance) { instance_double(Datadog::Statsd) }
12
13
  let(:data_dog?) { true }
13
14
  let(:dog_tags) { {} }
14
15
  let(:opts) { {} }
15
16
 
16
- describe '#event' do
17
- subject { event(title, text, opts) }
17
+ describe "#event" do
18
+ subject { event(title, text, **opts) }
18
19
 
19
- context 'with title and text only' do
20
+ context "with title and text only" do
20
21
  let(:opts) { {} }
21
22
 
22
23
  it 'invokes "event" on the instance with title and text' do
@@ -30,7 +31,7 @@ RSpec.describe InstStatsd::Event do
30
31
  end
31
32
  end
32
33
 
33
- context 'with alert_type set' do
34
+ context "with alert_type set" do
34
35
  let(:opts) { { alert_type: :error } }
35
36
 
36
37
  it 'invokes "event" on the instance with expected arguments' do
@@ -45,7 +46,7 @@ RSpec.describe InstStatsd::Event do
45
46
  end
46
47
  end
47
48
 
48
- context 'with priority set' do
49
+ context "with priority set" do
49
50
  let(:opts) { { priority: :low } }
50
51
 
51
52
  it 'invokes "event" on the instance with expected arguments' do
@@ -60,7 +61,7 @@ RSpec.describe InstStatsd::Event do
60
61
  end
61
62
  end
62
63
 
63
- context 'with date_happened set' do
64
+ context "with date_happened set" do
64
65
  let(:opts) { { date_happened: date_happened } }
65
66
  let(:date_happened) { Time.now.to_i }
66
67
 
@@ -76,10 +77,10 @@ RSpec.describe InstStatsd::Event do
76
77
  end
77
78
  end
78
79
 
79
- context 'with an invalid type set' do
80
+ context "with an invalid type set" do
80
81
  let(:opts) { { type: :banana } }
81
82
 
82
- it 'does not sent the invalid aggregation key' do
83
+ it "does not sent the invalid aggregation key" do
83
84
  expect(instance).to receive(:event).with(
84
85
  title,
85
86
  text,
@@ -90,35 +91,35 @@ RSpec.describe InstStatsd::Event do
90
91
  end
91
92
  end
92
93
 
93
- context 'with a valid type set' do
94
+ context "with a valid type set" do
94
95
  let(:opts) { { type: :deploy } }
95
96
 
96
- it 'sets the valid aggregation key' do
97
+ it "sets the valid aggregation key" do
97
98
  expect(instance).to receive(:event).with(
98
99
  title,
99
100
  text,
100
- tags: {type: :deploy}
101
+ tags: { type: :deploy }
101
102
  )
102
103
 
103
104
  subject
104
105
  end
105
106
  end
106
107
 
107
- context 'with custom tags' do
108
- let(:opts) { { tags: { project: 'cool-project'} } }
108
+ context "with custom tags" do
109
+ let(:opts) { { tags: { project: "cool-project" } } }
109
110
 
110
111
  it 'invokes "event" on the instance with expected arguments' do
111
112
  expect(instance).to receive(:event).with(
112
113
  title,
113
114
  text,
114
- tags: { project: 'cool-project' }
115
+ tags: { project: "cool-project" }
115
116
  )
116
117
 
117
118
  subject
118
119
  end
119
120
  end
120
121
 
121
- context 'with all opts set' do
122
+ context "with all opts set" do
122
123
  let(:date_happened) { Time.now.to_i }
123
124
  let(:opts) do
124
125
  {
@@ -126,28 +127,28 @@ RSpec.describe InstStatsd::Event do
126
127
  alert_type: :warning,
127
128
  priority: :low,
128
129
  date_happened: date_happened,
129
- tags: { foo: 'bar' }
130
+ tags: { foo: "bar" }
130
131
  }
131
132
  end
132
133
 
133
- it 'sets all arguments' do
134
+ it "sets all arguments" do
134
135
  expect(instance).to receive(:event).with(
135
136
  title,
136
137
  text,
137
138
  alert_type: :warning,
138
139
  priority: :low,
139
140
  date_happened: date_happened,
140
- tags: { foo: 'bar', type: :deploy }
141
+ tags: { foo: "bar", type: :deploy }
141
142
  )
142
143
 
143
144
  subject
144
145
  end
145
146
  end
146
147
 
147
- context 'when the instance is not DataDog' do
148
+ context "when the instance is not DataDog" do
148
149
  let(:data_dog?) { false }
149
150
 
150
- it { is_expected.to eq nil }
151
+ it { is_expected.to be_nil }
151
152
 
152
153
  it 'does not invoke "event" on the instance' do
153
154
  expect(instance).not_to receive(:event)
@@ -156,4 +157,4 @@ RSpec.describe InstStatsd::Event do
156
157
  end
157
158
  end
158
159
  end
159
- end
160
+ end