bullet 4.11.2 → 4.11.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/lib/bullet.rb +1 -0
- data/lib/bullet/notification/base.rb +5 -5
- data/lib/bullet/version.rb +1 -1
- data/spec/bullet/notification/base_spec.rb +37 -0
- data/spec/bullet_spec.rb +2 -2
- data/spec/integration/active_record3/association_spec.rb +1 -1
- data/spec/integration/active_record4/association_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ca96bf9ce0ec1f8610db4044ca48bc25ebf8ded
|
4
|
+
data.tar.gz: b2f6067c61713e0c0bb5c868d7f8e5464e09476c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d6ceb5f5ad0c7357a741bbd04b42bd188e38802a7a448aca7e289166570947a9941a224a306634ccd7e4ad99279c2e9dd1692935526dc0ef6b16fbdee26a0c3
|
7
|
+
data.tar.gz: fd48101ec26800797c4cd834905b3f8b1666631a39ac3f42f088430b82611d2b144daefc307fcc0cfffb07d788971b5e4d155269df642e7f2b2b83edde10128b
|
data/CHANGELOG.md
CHANGED
data/lib/bullet.rb
CHANGED
@@ -19,9 +19,9 @@ module Bullet
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def whoami
|
22
|
-
user
|
23
|
-
if user
|
24
|
-
"user: #{user
|
22
|
+
@user ||= ENV['USER'].presence || (`whoami`.chomp rescue "")
|
23
|
+
if @user.present?
|
24
|
+
"user: #{@user}"
|
25
25
|
else
|
26
26
|
""
|
27
27
|
end
|
@@ -36,7 +36,7 @@ module Bullet
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def full_notice
|
39
|
-
[whoami, url, title, body_with_caller].compact.join("\n")
|
39
|
+
[whoami.presence, url, title, body_with_caller].compact.join("\n")
|
40
40
|
end
|
41
41
|
|
42
42
|
def notify_inline
|
@@ -48,7 +48,7 @@ module Bullet
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def short_notice
|
51
|
-
[whoami, url, title, body].compact.join("\n")
|
51
|
+
[whoami.presence, url, title, body].compact.join("\n")
|
52
52
|
end
|
53
53
|
|
54
54
|
def notification_data
|
data/lib/bullet/version.rb
CHANGED
@@ -22,6 +22,35 @@ module Bullet
|
|
22
22
|
user = `whoami`.chomp
|
23
23
|
expect(subject.whoami).to eq("user: #{user}")
|
24
24
|
end
|
25
|
+
|
26
|
+
it "should leverage ENV parameter" do
|
27
|
+
temp_env_variable("USER", "bogus") do
|
28
|
+
expect(subject.whoami).to eq("user: bogus")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return blank if no user available" do
|
33
|
+
temp_env_variable("USER","") do
|
34
|
+
expect(subject).to receive(:`).with("whoami").and_return("")
|
35
|
+
expect(subject.whoami).to eq("")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should return blank if whoami is not available" do
|
40
|
+
temp_env_variable("USER","") do
|
41
|
+
expect(subject).to receive(:`).with("whoami").and_raise(Errno::ENOENT)
|
42
|
+
expect(subject.whoami).to eq("")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def temp_env_variable(name, value)
|
47
|
+
old_value = ENV[name]
|
48
|
+
ENV[name] = value
|
49
|
+
yield
|
50
|
+
ensure
|
51
|
+
ENV[name] = old_value
|
52
|
+
end
|
53
|
+
|
25
54
|
end
|
26
55
|
|
27
56
|
context "#body_with_caller" do
|
@@ -47,6 +76,14 @@ module Bullet
|
|
47
76
|
allow(subject).to receive(:body_with_caller).and_return("body_with_caller")
|
48
77
|
expect(subject.full_notice).to eq("whoami\nurl\ntitle\nbody_with_caller")
|
49
78
|
end
|
79
|
+
|
80
|
+
it "should return url + title + body_with_caller" do
|
81
|
+
allow(subject).to receive(:whoami).and_return("")
|
82
|
+
allow(subject).to receive(:url).and_return("url")
|
83
|
+
allow(subject).to receive(:title).and_return("title")
|
84
|
+
allow(subject).to receive(:body_with_caller).and_return("body_with_caller")
|
85
|
+
expect(subject.full_notice).to eq("url\ntitle\nbody_with_caller")
|
86
|
+
end
|
50
87
|
end
|
51
88
|
|
52
89
|
context "#notification_data" do
|
data/spec/bullet_spec.rb
CHANGED
@@ -26,8 +26,8 @@ describe Bullet, focused: true do
|
|
26
26
|
|
27
27
|
context 'enable Bullet again without patching again the orms' do
|
28
28
|
before do
|
29
|
-
Bullet::Mongoid.
|
30
|
-
Bullet::ActiveRecord.
|
29
|
+
expect(Bullet::Mongoid).not_to receive(:enable) if defined? Bullet::Mongoid
|
30
|
+
expect(Bullet::ActiveRecord).not_to receive(:enable) if defined? Bullet::ActiveRecord
|
31
31
|
Bullet.enable = true
|
32
32
|
end
|
33
33
|
|
@@ -371,7 +371,7 @@ if !mongoid? && active_record3?
|
|
371
371
|
comment.post.writer.newspaper.name
|
372
372
|
end
|
373
373
|
Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
|
374
|
-
Bullet::Detector::Association.
|
374
|
+
expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
|
375
375
|
|
376
376
|
expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Writer, :newspaper)
|
377
377
|
end
|
@@ -369,7 +369,7 @@ if !mongoid? && active_record4?
|
|
369
369
|
comment.post.writer.newspaper.name
|
370
370
|
end
|
371
371
|
Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
|
372
|
-
Bullet::Detector::Association.
|
372
|
+
expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
|
373
373
|
|
374
374
|
expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Writer, :newspaper)
|
375
375
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.11.
|
4
|
+
version: 4.11.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|