whoops_logger 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/whoops_logger.rb +4 -4
- data/spec/whoops_logger_spec.rb +5 -5
- data/whoops_logger.gemspec +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/lib/whoops_logger.rb
CHANGED
@@ -12,15 +12,15 @@ module WhoopsLogger
|
|
12
12
|
class << self
|
13
13
|
attr_accessor :strategies, :config
|
14
14
|
|
15
|
-
# @overload
|
15
|
+
# @overload log(raw_data)
|
16
16
|
# Notify using the default basic strategy
|
17
17
|
# @param [Hash] raw_data the raw_data expected by the basic strategy, used by strategy to build message
|
18
|
-
# @overload
|
18
|
+
# @overload log(strategy_name, raw_data)
|
19
19
|
# @param [Symbol, String] strategy_name
|
20
20
|
# @param [Hash] raw_data same as above
|
21
|
-
def
|
21
|
+
def log(strategy_name, raw_data = {})
|
22
22
|
if strategy_name.is_a? Hash
|
23
|
-
|
23
|
+
log("default::basic", strategy_name)
|
24
24
|
else
|
25
25
|
message_creator = MessageCreator.new(strategies[strategy_name], raw_data)
|
26
26
|
message_creator.create!
|
data/spec/whoops_logger_spec.rb
CHANGED
@@ -18,14 +18,14 @@ describe "WhoopsLogger" do
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
describe ".
|
21
|
+
describe ".log" do
|
22
22
|
let(:message_creator){ double(:message_creator, :create! => nil, :message => nil) }
|
23
23
|
|
24
24
|
it "uses the basic strategy if no strategy name is provided" do
|
25
25
|
WhoopsLogger.stub(:send_message)
|
26
26
|
message_creator.stub(:ignore_message?).and_return(false)
|
27
27
|
WhoopsLogger::MessageCreator.should_receive(:new).with(WhoopsLogger.strategies["default::basic"], {}).and_return(message_creator)
|
28
|
-
WhoopsLogger.
|
28
|
+
WhoopsLogger.log({})
|
29
29
|
end
|
30
30
|
|
31
31
|
it "sends a message when the message_creator is not ignoring the event" do
|
@@ -33,7 +33,7 @@ describe "WhoopsLogger" do
|
|
33
33
|
WhoopsLogger::MessageCreator.stub(:new).and_return(message_creator)
|
34
34
|
|
35
35
|
WhoopsLogger.should_receive(:send_message)
|
36
|
-
WhoopsLogger.
|
36
|
+
WhoopsLogger.log({})
|
37
37
|
end
|
38
38
|
|
39
39
|
it "does not sned a request if the message_creator is ignoring the event" do
|
@@ -41,14 +41,14 @@ describe "WhoopsLogger" do
|
|
41
41
|
WhoopsLogger::MessageCreator.stub(:new).and_return(message_creator)
|
42
42
|
|
43
43
|
WhoopsLogger.should_not_receive(:send_message)
|
44
|
-
WhoopsLogger.
|
44
|
+
WhoopsLogger.log({})
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
describe ".send_message" do
|
49
49
|
it "should send a message to the configured URL" do
|
50
50
|
FakeWeb.register_uri(:post, "http://whoops.com/events/", :body => "success")
|
51
|
-
WhoopsLogger.
|
51
|
+
WhoopsLogger.log({})
|
52
52
|
request = FakeWeb.last_request
|
53
53
|
request.body.should =~ /"event"/
|
54
54
|
end
|
data/whoops_logger.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whoops_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Daniel Higginbotham
|